From 39146d2e2e36ad96e8cf8b4f4bc9c426f1b80efb Mon Sep 17 00:00:00 2001 From: Eoghan Glynn Date: Thu, 19 Jul 2012 17:14:00 +0100 Subject: Ensure 413 response for security group over-quota Fixes LP 1021748 Instead of raising the relevant webob.exc exception directly, we now follow the usual pattern of mapping in the FaultWrapper middleware from an internal exception type to the corresponding HTTP error. Change-Id: Ifb43685e4f9b0b5bd53e74747d1f87aa5e119fb5 --- nova/tests/api/openstack/compute/contrib/test_security_groups.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'nova/tests') diff --git a/nova/tests/api/openstack/compute/contrib/test_security_groups.py b/nova/tests/api/openstack/compute/contrib/test_security_groups.py index 9e636de14..ea7d21db1 100644 --- a/nova/tests/api/openstack/compute/contrib/test_security_groups.py +++ b/nova/tests/api/openstack/compute/contrib/test_security_groups.py @@ -231,7 +231,8 @@ class TestSecurityGroups(test.TestCase): self.assertEqual(res_dict['security_group']['name'], name) sg = security_group_template() - self.assertRaises(webob.exc.HTTPBadRequest, self.controller.create, + self.assertRaises(exception.SecurityGroupLimitExceeded, + self.controller.create, req, {'security_group': sg}) def test_get_security_group_list(self): @@ -936,7 +937,8 @@ class TestSecurityGroupRules(test.TestCase): 'ip_protocol': 'tcp', 'from_port': '121', 'to_port': '121', 'parent_group_id': '2', 'group_id': '1' } - self.assertRaises(webob.exc.HTTPBadRequest, self.controller.create, + self.assertRaises(exception.SecurityGroupLimitExceeded, + self.controller.create, req, {'security_group_rule': rule}) -- cgit