Revision 9794e66a

b/kamaki/clients/test/cyclades.py
30 30
# documentation are those of the authors and should not be
31 31
# interpreted as representing official policies, either expressed
32 32
# or implied, of GRNET S.A.
33
from mock import patch, Mock
33
from mock import patch, Mock, call
34 34
from unittest import TestCase
35 35
from json import loads
36 36

  
......
586 586
            for i in range(len(r)):
587 587
                self.assert_dicts_are_equal(r[i], expected[i])
588 588

  
589
    def test_disconnect_network_nics(self):
590
        net_id = net_recv['network']['id']
591
        nics = ['nic1', 'nic2', 'nic3']
592
        with patch.object(
593
                CycladesClient,
594
                'list_network_nics',
595
                return_value=nics) as lnn:
596
            with patch.object(
597
                    CycladesClient,
598
                    'networks_post',
599
                    return_value=self.FR()) as np:
600
                self.client.disconnect_network_nics(net_id)
601
                lnn.assert_called_once_with(net_id)
602
                for i in range(len(nics)):
603
                    expected = call(net_id, 'action', json_data=dict(
604
                        remove=dict(attachment=nics[i])))
605
                    self.assertEqual(expected, np.mock_calls[i])
606

  
589 607
    def test_get_network_details(self):
590 608
        self.FR.json = net_recv
591 609
        net_id = net_recv['network']['id']

Also available in: Unified diff