forked from openstack/python-novaclient
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_networks.py
More file actions
40 lines (30 loc) · 1.26 KB
/
test_networks.py
File metadata and controls
40 lines (30 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from novaclient import exceptions
from novaclient.v1_1 import networks
from tests import utils
from tests.v1_1 import fakes
cs = fakes.FakeClient()
class NetworksTest(utils.TestCase):
def test_list_networks(self):
fl = cs.networks.list()
cs.assert_called('GET', '/os-networks')
[self.assertTrue(isinstance(f, networks.Network)) for f in fl]
def test_get_network(self):
f = cs.networks.get(1)
cs.assert_called('GET', '/os-networks/1')
self.assertTrue(isinstance(f, networks.Network))
def test_delete(self):
cs.networks.delete('networkdelete')
cs.assert_called('DELETE', '/os-networks/networkdelete')
def test_create(self):
f = cs.networks.create(label='foo')
cs.assert_called('POST', '/os-networks',
{'network': {'label': 'foo'}})
self.assertTrue(isinstance(f, networks.Network))
def test_disassociate(self):
cs.networks.disassociate('networkdisassociate')
cs.assert_called('POST', '/os-networks/networkdisassociate/action',
{'disassociate': None})
def test_add(self):
cs.networks.add('networkadd')
cs.assert_called('POST', '/os-networks/add',
{'id': 'networkadd'})