summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kurilin <akurilin@mirantis.com>2016-03-31 18:18:42 +0300
committerAndrey Kurilin <akurilin@mirantis.com>2016-04-01 19:23:33 +0300
commit7d8db71964922197443f85c74ac0e4510e3f58a0 (patch)
tree08fa40135a6ed37cad6e8079bedd7ca78c70c51b
parent8c204ac1a27f7b645e151d67ee38a4c18dd2201b (diff)
[tests] initialize client objects inside setUp
All tests from contrib dir inizialize fakeclient at module level. It is bad practice and we should do preparatory steps at setUp method. Change-Id: I2dd2988cd015d1dfb576fe004cb9461b02b55db3
Notes
Notes (review): Code-Review+2: Sean Dague <sean@dague.net> Code-Review+2: Kevin L. Mitchell <kevin.mitchell@rackspace.com> Workflow+1: Kevin L. Mitchell <kevin.mitchell@rackspace.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Mon, 04 Apr 2016 17:30:19 +0000 Reviewed-on: https://review.openstack.org/300032 Project: openstack/python-novaclient Branch: refs/heads/master
-rw-r--r--novaclient/tests/unit/v2/contrib/test_assisted_volume_snapshots.py22
-rw-r--r--novaclient/tests/unit/v2/contrib/test_baremetal.py44
-rw-r--r--novaclient/tests/unit/v2/contrib/test_cells.py27
-rw-r--r--novaclient/tests/unit/v2/contrib/test_instance_actions.py23
-rw-r--r--novaclient/tests/unit/v2/contrib/test_list_extensions.py19
-rw-r--r--novaclient/tests/unit/v2/contrib/test_migrations.py27
-rw-r--r--novaclient/tests/unit/v2/contrib/test_server_external_events.py19
-rw-r--r--novaclient/tests/unit/v2/contrib/test_tenant_networks.py32
8 files changed, 110 insertions, 103 deletions
diff --git a/novaclient/tests/unit/v2/contrib/test_assisted_volume_snapshots.py b/novaclient/tests/unit/v2/contrib/test_assisted_volume_snapshots.py
index 8cce986..374d2d8 100644
--- a/novaclient/tests/unit/v2/contrib/test_assisted_volume_snapshots.py
+++ b/novaclient/tests/unit/v2/contrib/test_assisted_volume_snapshots.py
@@ -22,23 +22,23 @@ from novaclient.tests.unit.v2.contrib import fakes
22from novaclient.v2.contrib import assisted_volume_snapshots as assisted_snaps 22from novaclient.v2.contrib import assisted_volume_snapshots as assisted_snaps
23 23
24 24
25extensions = [
26 extension.Extension(assisted_snaps.__name__.split(".")[-1],
27 assisted_snaps),
28]
29cs = fakes.FakeClient(extensions=extensions)
30
31
32class AssistedVolumeSnapshotsTestCase(utils.TestCase): 25class AssistedVolumeSnapshotsTestCase(utils.TestCase):
26 def setUp(self):
27 super(AssistedVolumeSnapshotsTestCase, self).setUp()
28 extensions = [
29 extension.Extension(assisted_snaps.__name__.split(".")[-1],
30 assisted_snaps),
31 ]
32 self.cs = fakes.FakeClient(extensions=extensions)
33 33
34 def test_create_snap(self): 34 def test_create_snap(self):
35 vs = cs.assisted_volume_snapshots.create('1', {}) 35 vs = self.cs.assisted_volume_snapshots.create('1', {})
36 self.assert_request_id(vs, fakes.FAKE_REQUEST_ID_LIST) 36 self.assert_request_id(vs, fakes.FAKE_REQUEST_ID_LIST)
37 cs.assert_called('POST', '/os-assisted-volume-snapshots') 37 self.cs.assert_called('POST', '/os-assisted-volume-snapshots')
38 38
39 def test_delete_snap(self): 39 def test_delete_snap(self):
40 vs = cs.assisted_volume_snapshots.delete('x', {}) 40 vs = self.cs.assisted_volume_snapshots.delete('x', {})
41 self.assert_request_id(vs, fakes.FAKE_REQUEST_ID_LIST) 41 self.assert_request_id(vs, fakes.FAKE_REQUEST_ID_LIST)
42 cs.assert_called( 42 self.cs.assert_called(
43 'DELETE', 43 'DELETE',
44 '/os-assisted-volume-snapshots/x?delete_info={}') 44 '/os-assisted-volume-snapshots/x?delete_info={}')
diff --git a/novaclient/tests/unit/v2/contrib/test_baremetal.py b/novaclient/tests/unit/v2/contrib/test_baremetal.py
index e44cd14..406e617 100644
--- a/novaclient/tests/unit/v2/contrib/test_baremetal.py
+++ b/novaclient/tests/unit/v2/contrib/test_baremetal.py
@@ -20,52 +20,52 @@ from novaclient.tests.unit.v2.contrib import fakes
20from novaclient.v2.contrib import baremetal 20from novaclient.v2.contrib import baremetal
21 21
22 22
23extensions = [
24 extension.Extension(baremetal.__name__.split(".")[-1], baremetal),
25]
26cs = fakes.FakeClient(extensions=extensions)
27
28
29class BaremetalExtensionTest(utils.TestCase): 23class BaremetalExtensionTest(utils.TestCase):
24 def setUp(self):
25 super(BaremetalExtensionTest, self).setUp()
26 extensions = [
27 extension.Extension(baremetal.__name__.split(".")[-1], baremetal),
28 ]
29 self.cs = fakes.FakeClient(extensions=extensions)
30 30
31 def test_list_nodes(self): 31 def test_list_nodes(self):
32 nl = cs.baremetal.list() 32 nl = self.cs.baremetal.list()
33 self.assert_request_id(nl, fakes.FAKE_REQUEST_ID_LIST) 33 self.assert_request_id(nl, fakes.FAKE_REQUEST_ID_LIST)
34 cs.assert_called('GET', '/os-baremetal-nodes') 34 self.cs.assert_called('GET', '/os-baremetal-nodes')
35 for n in nl: 35 for n in nl:
36 self.assertIsInstance(n, baremetal.BareMetalNode) 36 self.assertIsInstance(n, baremetal.BareMetalNode)
37 37
38 def test_get_node(self): 38 def test_get_node(self):
39 n = cs.baremetal.get(1) 39 n = self.cs.baremetal.get(1)
40 self.assert_request_id(n, fakes.FAKE_REQUEST_ID_LIST) 40 self.assert_request_id(n, fakes.FAKE_REQUEST_ID_LIST)
41 cs.assert_called('GET', '/os-baremetal-nodes/1') 41 self.cs.assert_called('GET', '/os-baremetal-nodes/1')
42 self.assertIsInstance(n, baremetal.BareMetalNode) 42 self.assertIsInstance(n, baremetal.BareMetalNode)
43 43
44 def test_create_node(self): 44 def test_create_node(self):
45 n = cs.baremetal.create("service_host", 1, 1024, 2048, 45 n = self.cs.baremetal.create("service_host", 1, 1024, 2048,
46 "aa:bb:cc:dd:ee:ff") 46 "aa:bb:cc:dd:ee:ff")
47 self.assert_request_id(n, fakes.FAKE_REQUEST_ID_LIST) 47 self.assert_request_id(n, fakes.FAKE_REQUEST_ID_LIST)
48 cs.assert_called('POST', '/os-baremetal-nodes') 48 self.cs.assert_called('POST', '/os-baremetal-nodes')
49 self.assertIsInstance(n, baremetal.BareMetalNode) 49 self.assertIsInstance(n, baremetal.BareMetalNode)
50 50
51 def test_delete_node(self): 51 def test_delete_node(self):
52 n = cs.baremetal.get(1) 52 n = self.cs.baremetal.get(1)
53 ret = cs.baremetal.delete(n) 53 ret = self.cs.baremetal.delete(n)
54 self.assert_request_id(ret, fakes.FAKE_REQUEST_ID_LIST) 54 self.assert_request_id(ret, fakes.FAKE_REQUEST_ID_LIST)
55 cs.assert_called('DELETE', '/os-baremetal-nodes/1') 55 self.cs.assert_called('DELETE', '/os-baremetal-nodes/1')
56 56
57 def test_node_add_interface(self): 57 def test_node_add_interface(self):
58 i = cs.baremetal.add_interface(1, "bb:cc:dd:ee:ff:aa", 1, 2) 58 i = self.cs.baremetal.add_interface(1, "bb:cc:dd:ee:ff:aa", 1, 2)
59 self.assert_request_id(i, fakes.FAKE_REQUEST_ID_LIST) 59 self.assert_request_id(i, fakes.FAKE_REQUEST_ID_LIST)
60 cs.assert_called('POST', '/os-baremetal-nodes/1/action') 60 self.cs.assert_called('POST', '/os-baremetal-nodes/1/action')
61 self.assertIsInstance(i, baremetal.BareMetalNodeInterface) 61 self.assertIsInstance(i, baremetal.BareMetalNodeInterface)
62 62
63 def test_node_remove_interface(self): 63 def test_node_remove_interface(self):
64 ret = cs.baremetal.remove_interface(1, "bb:cc:dd:ee:ff:aa") 64 ret = self.cs.baremetal.remove_interface(1, "bb:cc:dd:ee:ff:aa")
65 self.assert_request_id(ret, fakes.FAKE_REQUEST_ID_LIST) 65 self.assert_request_id(ret, fakes.FAKE_REQUEST_ID_LIST)
66 cs.assert_called('POST', '/os-baremetal-nodes/1/action') 66 self.cs.assert_called('POST', '/os-baremetal-nodes/1/action')
67 67
68 def test_node_list_interfaces(self): 68 def test_node_list_interfaces(self):
69 il = cs.baremetal.list_interfaces(1) 69 il = self.cs.baremetal.list_interfaces(1)
70 self.assert_request_id(il, fakes.FAKE_REQUEST_ID_LIST) 70 self.assert_request_id(il, fakes.FAKE_REQUEST_ID_LIST)
71 cs.assert_called('GET', '/os-baremetal-nodes/1') 71 self.cs.assert_called('GET', '/os-baremetal-nodes/1')
diff --git a/novaclient/tests/unit/v2/contrib/test_cells.py b/novaclient/tests/unit/v2/contrib/test_cells.py
index dd242c2..95a5c4b 100644
--- a/novaclient/tests/unit/v2/contrib/test_cells.py
+++ b/novaclient/tests/unit/v2/contrib/test_cells.py
@@ -19,27 +19,28 @@ from novaclient.tests.unit.v2.contrib import fakes
19from novaclient.v2.contrib import cells 19from novaclient.v2.contrib import cells
20 20
21 21
22extensions = [
23 extension.Extension(cells.__name__.split(".")[-1],
24 cells),
25]
26cs = fakes.FakeClient(extensions=extensions)
27
28
29class CellsExtensionTests(utils.TestCase): 22class CellsExtensionTests(utils.TestCase):
23 def setUp(self):
24 super(CellsExtensionTests, self).setUp()
25 extensions = [
26 extension.Extension(cells.__name__.split(".")[-1],
27 cells),
28 ]
29 self.cs = fakes.FakeClient(extensions=extensions)
30
30 def test_get_cells(self): 31 def test_get_cells(self):
31 cell_name = 'child_cell' 32 cell_name = 'child_cell'
32 cell = cs.cells.get(cell_name) 33 cell = self.cs.cells.get(cell_name)
33 self.assert_request_id(cell, fakes.FAKE_REQUEST_ID_LIST) 34 self.assert_request_id(cell, fakes.FAKE_REQUEST_ID_LIST)
34 cs.assert_called('GET', '/os-cells/%s' % cell_name) 35 self.cs.assert_called('GET', '/os-cells/%s' % cell_name)
35 36
36 def test_get_capacities_for_a_given_cell(self): 37 def test_get_capacities_for_a_given_cell(self):
37 cell_name = 'child_cell' 38 cell_name = 'child_cell'
38 ca = cs.cells.capacities(cell_name) 39 ca = self.cs.cells.capacities(cell_name)
39 self.assert_request_id(ca, fakes.FAKE_REQUEST_ID_LIST) 40 self.assert_request_id(ca, fakes.FAKE_REQUEST_ID_LIST)
40 cs.assert_called('GET', '/os-cells/%s/capacities' % cell_name) 41 self.cs.assert_called('GET', '/os-cells/%s/capacities' % cell_name)
41 42
42 def test_get_capacities_for_all_cells(self): 43 def test_get_capacities_for_all_cells(self):
43 ca = cs.cells.capacities() 44 ca = self.cs.cells.capacities()
44 self.assert_request_id(ca, fakes.FAKE_REQUEST_ID_LIST) 45 self.assert_request_id(ca, fakes.FAKE_REQUEST_ID_LIST)
45 cs.assert_called('GET', '/os-cells/capacities') 46 self.cs.assert_called('GET', '/os-cells/capacities')
diff --git a/novaclient/tests/unit/v2/contrib/test_instance_actions.py b/novaclient/tests/unit/v2/contrib/test_instance_actions.py
index 4f17fbd..394b37e 100644
--- a/novaclient/tests/unit/v2/contrib/test_instance_actions.py
+++ b/novaclient/tests/unit/v2/contrib/test_instance_actions.py
@@ -19,27 +19,28 @@ from novaclient.tests.unit.v2.contrib import fakes
19from novaclient.v2.contrib import instance_action 19from novaclient.v2.contrib import instance_action
20 20
21 21
22extensions = [
23 extension.Extension(instance_action.__name__.split(".")[-1],
24 instance_action),
25]
26cs = fakes.FakeClient(extensions=extensions)
27
28
29class InstanceActionExtensionTests(utils.TestCase): 22class InstanceActionExtensionTests(utils.TestCase):
23 def setUp(self):
24 super(InstanceActionExtensionTests, self).setUp()
25 extensions = [
26 extension.Extension(instance_action.__name__.split(".")[-1],
27 instance_action),
28 ]
29 self.cs = fakes.FakeClient(extensions=extensions)
30
30 def test_list_instance_actions(self): 31 def test_list_instance_actions(self):
31 server_uuid = '1234' 32 server_uuid = '1234'
32 ial = cs.instance_action.list(server_uuid) 33 ial = self.cs.instance_action.list(server_uuid)
33 self.assert_request_id(ial, fakes.FAKE_REQUEST_ID_LIST) 34 self.assert_request_id(ial, fakes.FAKE_REQUEST_ID_LIST)
34 cs.assert_called( 35 self.cs.assert_called(
35 'GET', '/servers/%s/os-instance-actions' % 36 'GET', '/servers/%s/os-instance-actions' %
36 server_uuid) 37 server_uuid)
37 38
38 def test_get_instance_action(self): 39 def test_get_instance_action(self):
39 server_uuid = '1234' 40 server_uuid = '1234'
40 request_id = 'req-abcde12345' 41 request_id = 'req-abcde12345'
41 ia = cs.instance_action.get(server_uuid, request_id) 42 ia = self.cs.instance_action.get(server_uuid, request_id)
42 self.assert_request_id(ia, fakes.FAKE_REQUEST_ID_LIST) 43 self.assert_request_id(ia, fakes.FAKE_REQUEST_ID_LIST)
43 cs.assert_called( 44 self.cs.assert_called(
44 'GET', '/servers/%s/os-instance-actions/%s' 45 'GET', '/servers/%s/os-instance-actions/%s'
45 % (server_uuid, request_id)) 46 % (server_uuid, request_id))
diff --git a/novaclient/tests/unit/v2/contrib/test_list_extensions.py b/novaclient/tests/unit/v2/contrib/test_list_extensions.py
index 3c77293..5c6d369 100644
--- a/novaclient/tests/unit/v2/contrib/test_list_extensions.py
+++ b/novaclient/tests/unit/v2/contrib/test_list_extensions.py
@@ -17,18 +17,19 @@ from novaclient.tests.unit.v2 import fakes
17from novaclient.v2.contrib import list_extensions 17from novaclient.v2.contrib import list_extensions
18 18
19 19
20extensions = [
21 extension.Extension(list_extensions.__name__.split(".")[-1],
22 list_extensions),
23]
24cs = fakes.FakeClient(extensions=extensions)
25
26
27class ListExtensionsTests(utils.TestCase): 20class ListExtensionsTests(utils.TestCase):
21 def setUp(self):
22 super(ListExtensionsTests, self).setUp()
23 extensions = [
24 extension.Extension(list_extensions.__name__.split(".")[-1],
25 list_extensions),
26 ]
27 self.cs = fakes.FakeClient(extensions=extensions)
28
28 def test_list_extensions(self): 29 def test_list_extensions(self):
29 all_exts = cs.list_extensions.show_all() 30 all_exts = self.cs.list_extensions.show_all()
30 self.assert_request_id(all_exts, fakes.FAKE_REQUEST_ID_LIST) 31 self.assert_request_id(all_exts, fakes.FAKE_REQUEST_ID_LIST)
31 cs.assert_called('GET', '/extensions') 32 self.cs.assert_called('GET', '/extensions')
32 self.assertTrue(len(all_exts) > 0) 33 self.assertTrue(len(all_exts) > 0)
33 for r in all_exts: 34 for r in all_exts:
34 self.assertTrue(len(r.summary) > 0) 35 self.assertTrue(len(r.summary) > 0)
diff --git a/novaclient/tests/unit/v2/contrib/test_migrations.py b/novaclient/tests/unit/v2/contrib/test_migrations.py
index 8d12633..d203e64 100644
--- a/novaclient/tests/unit/v2/contrib/test_migrations.py
+++ b/novaclient/tests/unit/v2/contrib/test_migrations.py
@@ -16,25 +16,26 @@ from novaclient.tests.unit import utils
16from novaclient.tests.unit.v2 import fakes 16from novaclient.tests.unit.v2 import fakes
17from novaclient.v2.contrib import migrations 17from novaclient.v2.contrib import migrations
18 18
19extensions = [
20 extension.Extension(migrations.__name__.split(".")[-1],
21 migrations),
22]
23cs = fakes.FakeClient(extensions=extensions)
24
25 19
26class MigrationsTest(utils.TestCase): 20class MigrationsTest(utils.TestCase):
21 def setUp(self):
22 super(MigrationsTest, self).setUp()
23 self.extensions = [
24 extension.Extension(migrations.__name__.split(".")[-1],
25 migrations),
26 ]
27 self.cs = fakes.FakeClient(extensions=self.extensions)
27 28
28 def test_list_migrations(self): 29 def test_list_migrations(self):
29 ml = cs.migrations.list() 30 ml = self.cs.migrations.list()
30 self.assert_request_id(ml, fakes.FAKE_REQUEST_ID_LIST) 31 self.assert_request_id(ml, fakes.FAKE_REQUEST_ID_LIST)
31 cs.assert_called('GET', '/os-migrations') 32 self.cs.assert_called('GET', '/os-migrations')
32 for m in ml: 33 for m in ml:
33 self.assertIsInstance(m, migrations.Migration) 34 self.assertIsInstance(m, migrations.Migration)
34 self.assertRaises(AttributeError, getattr, m, "migration_type") 35 self.assertRaises(AttributeError, getattr, m, "migration_type")
35 36
36 def test_list_migrations_v223(self): 37 def test_list_migrations_v223(self):
37 cs = fakes.FakeClient(extensions=extensions, 38 cs = fakes.FakeClient(extensions=self.extensions,
38 api_version=api_versions.APIVersion("2.23")) 39 api_version=api_versions.APIVersion("2.23"))
39 ml = cs.migrations.list() 40 ml = cs.migrations.list()
40 self.assert_request_id(ml, fakes.FAKE_REQUEST_ID_LIST) 41 self.assert_request_id(ml, fakes.FAKE_REQUEST_ID_LIST)
@@ -44,11 +45,11 @@ class MigrationsTest(utils.TestCase):
44 self.assertEqual(m.migration_type, 'live-migration') 45 self.assertEqual(m.migration_type, 'live-migration')
45 46
46 def test_list_migrations_with_filters(self): 47 def test_list_migrations_with_filters(self):
47 ml = cs.migrations.list('host1', 'finished', 'child1') 48 ml = self.cs.migrations.list('host1', 'finished', 'child1')
48 self.assert_request_id(ml, fakes.FAKE_REQUEST_ID_LIST) 49 self.assert_request_id(ml, fakes.FAKE_REQUEST_ID_LIST)
49 50
50 cs.assert_called('GET', 51 self.cs.assert_called(
51 '/os-migrations?cell_name=child1&host=host1' 52 'GET',
52 '&status=finished') 53 '/os-migrations?cell_name=child1&host=host1&status=finished')
53 for m in ml: 54 for m in ml:
54 self.assertIsInstance(m, migrations.Migration) 55 self.assertIsInstance(m, migrations.Migration)
diff --git a/novaclient/tests/unit/v2/contrib/test_server_external_events.py b/novaclient/tests/unit/v2/contrib/test_server_external_events.py
index b843bd8..009a0d8 100644
--- a/novaclient/tests/unit/v2/contrib/test_server_external_events.py
+++ b/novaclient/tests/unit/v2/contrib/test_server_external_events.py
@@ -22,14 +22,15 @@ from novaclient.tests.unit.v2.contrib import fakes
22from novaclient.v2.contrib import server_external_events as ext_events 22from novaclient.v2.contrib import server_external_events as ext_events
23 23
24 24
25extensions = [
26 extension.Extension(ext_events.__name__.split(".")[-1],
27 ext_events),
28]
29cs = fakes.FakeClient(extensions=extensions)
30
31
32class ServerExternalEventsTestCase(utils.TestCase): 25class ServerExternalEventsTestCase(utils.TestCase):
26 def setUp(self):
27 super(ServerExternalEventsTestCase, self).setUp()
28 extensions = [
29 extension.Extension(ext_events.__name__.split(".")[-1],
30 ext_events),
31 ]
32 self.cs = fakes.FakeClient(extensions=extensions)
33
33 def test_external_event(self): 34 def test_external_event(self):
34 events = [{'server_uuid': 'fake-uuid1', 35 events = [{'server_uuid': 'fake-uuid1',
35 'name': 'test-event', 36 'name': 'test-event',
@@ -39,7 +40,7 @@ class ServerExternalEventsTestCase(utils.TestCase):
39 'name': 'test-event', 40 'name': 'test-event',
40 'status': 'completed', 41 'status': 'completed',
41 'tag': 'tag'}] 42 'tag': 'tag'}]
42 result = cs.server_external_events.create(events) 43 result = self.cs.server_external_events.create(events)
43 self.assert_request_id(result, fakes.FAKE_REQUEST_ID_LIST) 44 self.assert_request_id(result, fakes.FAKE_REQUEST_ID_LIST)
44 self.assertEqual(events, result) 45 self.assertEqual(events, result)
45 cs.assert_called('POST', '/os-server-external-events') 46 self.cs.assert_called('POST', '/os-server-external-events')
diff --git a/novaclient/tests/unit/v2/contrib/test_tenant_networks.py b/novaclient/tests/unit/v2/contrib/test_tenant_networks.py
index 2f0d7e3..e199427 100644
--- a/novaclient/tests/unit/v2/contrib/test_tenant_networks.py
+++ b/novaclient/tests/unit/v2/contrib/test_tenant_networks.py
@@ -19,32 +19,34 @@ from novaclient.tests.unit.v2.contrib import fakes
19from novaclient.v2.contrib import tenant_networks 19from novaclient.v2.contrib import tenant_networks
20 20
21 21
22extensions = [ 22class TenantNetworkExtensionTests(utils.TestCase):
23 extension.Extension(tenant_networks.__name__.split(".")[-1],
24 tenant_networks),
25]
26cs = fakes.FakeClient(extensions=extensions)
27 23
24 def setUp(self):
25 super(TenantNetworkExtensionTests, self).setUp()
26 extensions = [
27 extension.Extension(tenant_networks.__name__.split(".")[-1],
28 tenant_networks),
29 ]
30 self.cs = fakes.FakeClient(extensions=extensions)
28 31
29class TenantNetworkExtensionTests(utils.TestCase):
30 def test_list_tenant_networks(self): 32 def test_list_tenant_networks(self):
31 nets = cs.tenant_networks.list() 33 nets = self.cs.tenant_networks.list()
32 self.assert_request_id(nets, fakes.FAKE_REQUEST_ID_LIST) 34 self.assert_request_id(nets, fakes.FAKE_REQUEST_ID_LIST)
33 cs.assert_called('GET', '/os-tenant-networks') 35 self.cs.assert_called('GET', '/os-tenant-networks')
34 self.assertTrue(len(nets) > 0) 36 self.assertTrue(len(nets) > 0)
35 37
36 def test_get_tenant_network(self): 38 def test_get_tenant_network(self):
37 net = cs.tenant_networks.get(1) 39 net = self.cs.tenant_networks.get(1)
38 self.assert_request_id(net, fakes.FAKE_REQUEST_ID_LIST) 40 self.assert_request_id(net, fakes.FAKE_REQUEST_ID_LIST)
39 cs.assert_called('GET', '/os-tenant-networks/1') 41 self.cs.assert_called('GET', '/os-tenant-networks/1')
40 42
41 def test_create_tenant_networks(self): 43 def test_create_tenant_networks(self):
42 net = cs.tenant_networks.create(label="net", 44 net = self.cs.tenant_networks.create(label="net",
43 cidr="10.0.0.0/24") 45 cidr="10.0.0.0/24")
44 self.assert_request_id(net, fakes.FAKE_REQUEST_ID_LIST) 46 self.assert_request_id(net, fakes.FAKE_REQUEST_ID_LIST)
45 cs.assert_called('POST', '/os-tenant-networks') 47 self.cs.assert_called('POST', '/os-tenant-networks')
46 48
47 def test_delete_tenant_networks(self): 49 def test_delete_tenant_networks(self):
48 ret = cs.tenant_networks.delete(1) 50 ret = self.cs.tenant_networks.delete(1)
49 self.assert_request_id(ret, fakes.FAKE_REQUEST_ID_LIST) 51 self.assert_request_id(ret, fakes.FAKE_REQUEST_ID_LIST)
50 cs.assert_called('DELETE', '/os-tenant-networks/1') 52 self.cs.assert_called('DELETE', '/os-tenant-networks/1')