diff options
author | Jenkins <jenkins@review.openstack.org> | 2017-04-25 18:58:01 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2017-04-25 18:58:01 +0000 |
commit | 7d54163b165c8aae7c287d5b4b1456e2286ccf21 (patch) | |
tree | 0ed2b8f6483cff3f05f9ff5944ab2f385669e6dc /nova/tests/unit/api | |
parent | 0410ddaa82317d7d61ab67b05803b10301afc622 (diff) | |
parent | 03ce16988463c08761e9dbe90579792dcdf94c68 (diff) | |
download | nova-7d54163b165c8aae7c287d5b4b1456e2286ccf21.tar.gz |
Merge "Deprecate Multinic, floatingip action and os-virtual-interface API"
Diffstat (limited to 'nova/tests/unit/api')
3 files changed, 52 insertions, 19 deletions
diff --git a/nova/tests/unit/api/openstack/compute/test_floating_ips.py b/nova/tests/unit/api/openstack/compute/test_floating_ips.py index d184769fdb..1cb214142d 100644 --- a/nova/tests/unit/api/openstack/compute/test_floating_ips.py +++ b/nova/tests/unit/api/openstack/compute/test_floating_ips.py @@ -987,3 +987,22 @@ class FloatingIpsDeprecationTest(test.NoDBTestCase): self.controller.create, self.req, {}) self.assertRaises(exception.VersionNotFoundForAPIMethod, self.controller.delete, self.req, fakes.FAKE_UUID) + + +class FloatingIpActionDeprecationTest(test.NoDBTestCase): + + def setUp(self): + super(FloatingIpActionDeprecationTest, self).setUp() + self.req = fakes.HTTPRequest.blank('', version='2.44') + self.controller = fips_v21.FloatingIPActionController() + + def test_add_floating_ip_not_found(self): + body = dict(addFloatingIp=dict(address='10.10.10.11')) + self.assertRaises(exception.VersionNotFoundForAPIMethod, + self.controller._add_floating_ip, self.req, FAKE_UUID, body=body) + + def test_remove_floating_ip_not_found(self): + body = dict(removeFloatingIp=dict(address='10.10.10.10')) + self.assertRaises(exception.VersionNotFoundForAPIMethod, + self.controller._remove_floating_ip, self.req, FAKE_UUID, + body=body) diff --git a/nova/tests/unit/api/openstack/compute/test_multinic.py b/nova/tests/unit/api/openstack/compute/test_multinic.py index 3ebb3cecf5..148d8906ed 100644 --- a/nova/tests/unit/api/openstack/compute/test_multinic.py +++ b/nova/tests/unit/api/openstack/compute/test_multinic.py @@ -71,15 +71,7 @@ class FixedIpTestV21(test.NoDBTestCase): last_add_fixed_ip = (None, None) body = dict(addFixedIp=dict(networkId='test_net')) - resp = self.controller._add_fixed_ip(self.fake_req, UUID, body=body) - # NOTE: on v2.1, http status code is set as wsgi_code of API - # method instead of status_int in a response object. - if isinstance(self.controller, - multinic_v21.MultinicController): - status_int = self.controller._add_fixed_ip.wsgi_code - else: - status_int = resp.status_int - self.assertEqual(status_int, 202) + self.controller._add_fixed_ip(self.fake_req, UUID, body=body) self.assertEqual(last_add_fixed_ip, (UUID, 'test_net')) def _test_add_fixed_ip_bad_request(self, body): @@ -119,15 +111,7 @@ class FixedIpTestV21(test.NoDBTestCase): last_remove_fixed_ip = (None, None) body = dict(removeFixedIp=dict(address='10.10.10.1')) - resp = self.controller._remove_fixed_ip(self.fake_req, UUID, body=body) - # NOTE: on v2.1, http status code is set as wsgi_code of API - # method instead of status_int in a response object. - if isinstance(self.controller, - multinic_v21.MultinicController): - status_int = self.controller._remove_fixed_ip.wsgi_code - else: - status_int = resp.status_int - self.assertEqual(status_int, 202) + self.controller._remove_fixed_ip(self.fake_req, UUID, body=body) self.assertEqual(last_remove_fixed_ip, (UUID, '10.10.10.1')) def test_remove_fixed_ip_no_address(self): @@ -188,3 +172,21 @@ class MultinicPolicyEnforcementV21(test.NoDBTestCase): self.assertEqual( "Policy doesn't allow %s to be performed." % rule_name, exc.format_message()) + + +class MultinicAPIDeprecationTest(test.NoDBTestCase): + + def setUp(self): + super(MultinicAPIDeprecationTest, self).setUp() + self.controller = multinic_v21.MultinicController() + self.req = fakes.HTTPRequest.blank('', version='2.44') + + def test_add_fixed_ip_not_found(self): + body = dict(addFixedIp=dict(networkId='test_net')) + self.assertRaises(exception.VersionNotFoundForAPIMethod, + self.controller._add_fixed_ip, self.req, UUID, body=body) + + def test_remove_fixed_ip__not_found(self): + body = dict(removeFixedIp=dict(address='10.10.10.1')) + self.assertRaises(exception.VersionNotFoundForAPIMethod, + self.controller._remove_fixed_ip, self.req, UUID, body=body) diff --git a/nova/tests/unit/api/openstack/compute/test_virtual_interfaces.py b/nova/tests/unit/api/openstack/compute/test_virtual_interfaces.py index 96552341f0..87a3b09fb4 100644 --- a/nova/tests/unit/api/openstack/compute/test_virtual_interfaces.py +++ b/nova/tests/unit/api/openstack/compute/test_virtual_interfaces.py @@ -61,7 +61,7 @@ class FakeRequest(object): class ServerVirtualInterfaceTestV21(test.NoDBTestCase): - wsgi_api_version = None + wsgi_api_version = '2.1' expected_response = { 'virtual_interfaces': [ {'id': uuids.vif1_uuid, @@ -155,3 +155,15 @@ class ServerVirtualInterfaceEnforcementV21(test.NoDBTestCase): self.assertEqual( "Policy doesn't allow %s to be performed." % rule_name, exc.format_message()) + + +class ServerVirtualInterfaceDeprecationTest(test.NoDBTestCase): + + def setUp(self): + super(ServerVirtualInterfaceDeprecationTest, self).setUp() + self.controller = vi21.ServerVirtualInterfaceController() + self.req = fakes.HTTPRequest.blank('', version='2.44') + + def test_index_not_found(self): + self.assertRaises(exception.VersionNotFoundForAPIMethod, + self.controller.index, self.req, FAKE_UUID) |