diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-09-27 16:47:43 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-09-27 16:47:43 +0000 |
| commit | 3ea56ce6c8d0dd6f1671e4519423c4dcce235b7a (patch) | |
| tree | 2f524a7fb3977e7c75ba4c2fc3698263cd8d6b8e /nova/tests | |
| parent | 1328318e36969aa9ba595a6f2634618b6d658c32 (diff) | |
| parent | be4f059aa225fde6170f75a1abd338cadc351ef2 (diff) | |
Merge "Modified 404 error response to show specific message"
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/api/openstack/compute/contrib/test_floating_ips.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/nova/tests/api/openstack/compute/contrib/test_floating_ips.py b/nova/tests/api/openstack/compute/contrib/test_floating_ips.py index f7788101c..7f5583492 100644 --- a/nova/tests/api/openstack/compute/contrib/test_floating_ips.py +++ b/nova/tests/api/openstack/compute/contrib/test_floating_ips.py @@ -197,6 +197,21 @@ class FloatingIpTest(test.TestCase): 'id': 2}]} self.assertEqual(res_dict, response) + def test_floating_ip_release_nonexisting(self): + def fake_get_floating_ip(*args, **kwargs): + raise exception.FloatingIpNotFound(id=id) + + self.stubs.Set(network.api.API, "get_floating_ip", + fake_get_floating_ip) + + req = fakes.HTTPRequest.blank('/v2/fake/os-floating-ips/9876') + req.method = 'DELETE' + res = req.get_response(fakes.wsgi_app()) + self.assertEqual(res.status_int, 404) + expected_msg = ('{"itemNotFound": {"message": "Floating ip not found ' + 'for id 9876", "code": 404}}') + self.assertEqual(res.body, expected_msg) + def test_floating_ip_show(self): req = fakes.HTTPRequest.blank('/v2/fake/os-floating-ips/1') res_dict = self.controller.show(req, 1) @@ -214,8 +229,11 @@ class FloatingIpTest(test.TestCase): req = fakes.HTTPRequest.blank('/v2/fake/os-floating-ips/9876') - self.assertRaises(webob.exc.HTTPNotFound, - self.controller.show, req, 9876) + res = req.get_response(fakes.wsgi_app()) + self.assertEqual(res.status_int, 404) + expected_msg = ('{"itemNotFound": {"message": "Floating ip not found ' + 'for id 9876", "code": 404}}') + self.assertEqual(res.body, expected_msg) def test_show_associated_floating_ip(self): def get_floating_ip(self, context, id): |
