summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-08-21 02:33:34 +0000
committerGerrit Code Review <review@openstack.org>2012-08-21 02:33:34 +0000
commit0272c063bbc32f1ff39f2baa8ae3f0764723ef73 (patch)
treeb60c5aae26321138c75bbf7ba05e71974b400bee /nova/tests
parent8d633f251f624bb109315573fc149bd7e4781d94 (diff)
parent1a605cccb1fe29ae6554ad5afa3110abef11d9c2 (diff)
Merge "Return HTTP 422 on bad server update PUT request."
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/api/openstack/compute/test_servers.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/nova/tests/api/openstack/compute/test_servers.py b/nova/tests/api/openstack/compute/test_servers.py
index 662a272f8..fd3597b68 100644
--- a/nova/tests/api/openstack/compute/test_servers.py
+++ b/nova/tests/api/openstack/compute/test_servers.py
@@ -4765,7 +4765,7 @@ class ServersAllExtensionsTestCase(test.TestCase):
"""Test create with malformed body"""
def fake_create(*args, **kwargs):
- raise Exception("Request should not reach the compute API.")
+ raise test.TestingException("Should not reach the compute API.")
self.stubs.Set(nova.compute.api.API, 'create', fake_create)
@@ -4777,3 +4777,20 @@ class ServersAllExtensionsTestCase(test.TestCase):
req.body = jsonutils.dumps(body)
res = req.get_response(self.app)
self.assertEqual(422, res.status_int)
+
+ def test_update_missing_server(self):
+ """Test create with malformed body"""
+
+ def fake_update(*args, **kwargs):
+ raise test.TestingException("Should not reach the compute API.")
+
+ self.stubs.Set(nova.compute.api.API, 'create', fake_update)
+
+ req = fakes.HTTPRequest.blank('/fake/servers/1')
+ req.method = 'PUT'
+ req.content_type = 'application/json'
+ body = {'foo': {'a': 'b'}}
+
+ req.body = jsonutils.dumps(body)
+ res = req.get_response(self.app)
+ self.assertEqual(422, res.status_int)