diff options
author | He Jie Xu <xuhj@linux.vnet.ibm.com> | 2013-08-22 15:42:00 +0800 |
---|---|---|
committer | He Jie Xu <xuhj@linux.vnet.ibm.com> | 2013-08-22 15:42:00 +0800 |
commit | eb4c55995a208f0a6e7b4e0c9cf22d6025bc3f2b (patch) | |
tree | fbd9d122ae3211068ced3a75e54fa4d8a9890dc2 /nova/tests/api | |
parent | 0ee03b07305d7d0e6c910579e8c66d53741cf9c0 (diff) | |
download | nova-eb4c55995a208f0a6e7b4e0c9cf22d6025bc3f2b.tar.gz |
Correct the status code to 201 for create v3
Partially implements bp nova-v3-api
DocImpact
Change-Id: Ie7413f0f6473ad12b84f84688c7c8c377ebf39e1
Diffstat (limited to 'nova/tests/api')
8 files changed, 10 insertions, 4 deletions
diff --git a/nova/tests/api/openstack/compute/plugins/v3/test_agents.py b/nova/tests/api/openstack/compute/plugins/v3/test_agents.py index 840f559333..18e16ee834 100644 --- a/nova/tests/api/openstack/compute/plugins/v3/test_agents.py +++ b/nova/tests/api/openstack/compute/plugins/v3/test_agents.py @@ -120,6 +120,7 @@ class AgentsTest(test.TestCase): 'agent_id': 1}} res_dict = self.controller.create(req, body) self.assertEqual(res_dict, response) + self.assertEqual(self.controller.create.wsgi_code, 201) def test_agents_create_with_existed_agent(self): self.stubs.Set(db, 'agent_build_create', diff --git a/nova/tests/api/openstack/compute/plugins/v3/test_baremetal_nodes.py b/nova/tests/api/openstack/compute/plugins/v3/test_baremetal_nodes.py index 5b9f851182..0ab5097946 100644 --- a/nova/tests/api/openstack/compute/plugins/v3/test_baremetal_nodes.py +++ b/nova/tests/api/openstack/compute/plugins/v3/test_baremetal_nodes.py @@ -58,6 +58,7 @@ class BareMetalNodesTest(test.TestCase): self.mox.ReplayAll() res_dict = self.controller.create(self.request, {'node': node}) self.assertEqual({'node': response}, res_dict) + self.assertEqual(self.controller.create.wsgi_code, 201) def test_delete(self): self.mox.StubOutWithMock(db, 'bm_node_destroy') diff --git a/nova/tests/api/openstack/compute/plugins/v3/test_cells.py b/nova/tests/api/openstack/compute/plugins/v3/test_cells.py index aa0a88bfd8..62d4b7bcd7 100644 --- a/nova/tests/api/openstack/compute/plugins/v3/test_cells.py +++ b/nova/tests/api/openstack/compute/plugins/v3/test_cells.py @@ -164,7 +164,7 @@ class CellsTest(test.TestCase): req = self._get_request("cells") res_dict = self.controller.create(req, body) cell = res_dict['cell'] - + self.assertEqual(self.controller.create.wsgi_code, 201) self.assertEqual(cell['name'], 'meow') self.assertEqual(cell['username'], 'fred') self.assertEqual(cell['rpc_host'], 'r3.example.org') @@ -182,7 +182,7 @@ class CellsTest(test.TestCase): req = self._get_request("cells") res_dict = self.controller.create(req, body) cell = res_dict['cell'] - + self.assertEqual(self.controller.create.wsgi_code, 201) self.assertEqual(cell['name'], 'meow') self.assertEqual(cell['username'], 'fred') self.assertEqual(cell['rpc_host'], 'r3.example.org') diff --git a/nova/tests/api/openstack/compute/plugins/v3/test_certificates.py b/nova/tests/api/openstack/compute/plugins/v3/test_certificates.py index a99c7a4b01..2a364a6087 100644 --- a/nova/tests/api/openstack/compute/plugins/v3/test_certificates.py +++ b/nova/tests/api/openstack/compute/plugins/v3/test_certificates.py @@ -70,6 +70,7 @@ class CertificatesTest(test.TestCase): pk, cert = fake_create_cert(self.context) response = {'certificate': {'data': cert, 'private_key': pk}} self.assertEqual(res_dict, response) + self.assertEqual(self.controller.create.wsgi_code, 201) class CertificatesSerializerTest(test.TestCase): diff --git a/nova/tests/api/openstack/compute/plugins/v3/test_consoles.py b/nova/tests/api/openstack/compute/plugins/v3/test_consoles.py index b526fbf8e0..471d81674b 100644 --- a/nova/tests/api/openstack/compute/plugins/v3/test_consoles.py +++ b/nova/tests/api/openstack/compute/plugins/v3/test_consoles.py @@ -145,6 +145,7 @@ class ConsolesControllerTest(test.TestCase): req = fakes.HTTPRequestV3.blank(self.url) self.controller.create(req, self.uuid) + self.assertEqual(self.controller.create.wsgi_code, 201) def test_create_console_unknown_instance(self): def fake_create_console(cons_self, context, instance_id): diff --git a/nova/tests/api/openstack/compute/plugins/v3/test_flavors_extra_specs.py b/nova/tests/api/openstack/compute/plugins/v3/test_flavors_extra_specs.py index 01093d603a..7d92a07219 100644 --- a/nova/tests/api/openstack/compute/plugins/v3/test_flavors_extra_specs.py +++ b/nova/tests/api/openstack/compute/plugins/v3/test_flavors_extra_specs.py @@ -123,6 +123,7 @@ class FlavorsExtraSpecsTest(test.TestCase): res_dict = self.controller.create(req, 1, body) self.assertEqual('value1', res_dict['extra_specs']['key1']) + self.assertEqual(self.controller.create.wsgi_code, 201) def test_create_no_admin(self): self.stubs.Set(nova.db, diff --git a/nova/tests/api/openstack/compute/plugins/v3/test_keypairs.py b/nova/tests/api/openstack/compute/plugins/v3/test_keypairs.py index f16bdde1fe..8ec675ef77 100644 --- a/nova/tests/api/openstack/compute/plugins/v3/test_keypairs.py +++ b/nova/tests/api/openstack/compute/plugins/v3/test_keypairs.py @@ -90,7 +90,7 @@ class KeypairsTest(test.TestCase): req.body = jsonutils.dumps(body) req.headers['Content-Type'] = 'application/json' res = req.get_response(self.app) - self.assertEqual(res.status_int, 200) + self.assertEqual(res.status_int, 201) res_dict = jsonutils.loads(res.body) self.assertTrue(len(res_dict['keypair']['fingerprint']) > 0) self.assertTrue(len(res_dict['keypair']['private_key']) > 0) @@ -164,7 +164,7 @@ class KeypairsTest(test.TestCase): req.body = jsonutils.dumps(body) req.headers['Content-Type'] = 'application/json' res = req.get_response(self.app) - self.assertEqual(res.status_int, 200) + self.assertEqual(res.status_int, 201) # FIXME(ja): sholud we check that public_key was sent to create? res_dict = jsonutils.loads(res.body) self.assertTrue(len(res_dict['keypair']['fingerprint']) > 0) diff --git a/nova/tests/api/openstack/compute/plugins/v3/test_server_metadata.py b/nova/tests/api/openstack/compute/plugins/v3/test_server_metadata.py index 7393091ca1..2b688329d8 100644 --- a/nova/tests/api/openstack/compute/plugins/v3/test_server_metadata.py +++ b/nova/tests/api/openstack/compute/plugins/v3/test_server_metadata.py @@ -216,6 +216,7 @@ class ServerMetaDataTest(BaseTest): "key3": "value3", }) self.assertEqual(body, res_dict) + self.assertEqual(self.controller.create.wsgi_code, 201) def test_create_empty_body(self): self.stubs.Set(nova.db, 'instance_metadata_update', |