]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Add exception validation for subnet used.
authorGary Kotton <gkotton@redhat.com>
Mon, 14 Jan 2013 10:01:20 +0000 (10:01 +0000)
committerGary Kotton <gkotton@redhat.com>
Mon, 14 Jan 2013 10:02:40 +0000 (10:02 +0000)
As a result of bug 1093754 there was no validation of the actual
exception returned.

Change-Id: Ia3104ca523d30ea40c354afa62ed5ce2b88d5b7e

quantum/tests/unit/test_db_plugin.py

index dfad15381b26cd375a1653f735601dbb4712a013..e3ecdd26f9caec4ccba2527d3dd574958291ebfd 100644 (file)
@@ -2052,10 +2052,13 @@ class TestSubnetsV2(QuantumDbPluginV2TestCase):
     def test_delete_subnet_port_exists_owned_by_other(self):
         with self.subnet() as subnet:
             with self.port(subnet=subnet) as port:
-                req = self.new_delete_request('subnets',
-                                              subnet['subnet']['id'])
+                id = subnet['subnet']['id']
+                req = self.new_delete_request('subnets', id)
                 res = req.get_response(self.api)
+                data = self.deserialize('json', res)
                 self.assertEqual(res.status_int, 409)
+                msg = str(q_exc.SubnetInUse(subnet_id=id))
+                self.assertEqual(data['QuantumError'], msg)
 
     def test_delete_network(self):
         gateway_ip = '10.0.0.1'