update floating ips tests

This commit is contained in:
Chris Behrens
2011-09-21 08:47:33 +00:00
parent aff43d206a
commit 4d0bb8730a
2 changed files with 7 additions and 2 deletions

View File

@@ -144,6 +144,8 @@ class Floating_ips(extensions.ExtensionDescriptor):
address)
except exception.ApiError, e:
raise webob.exc.HTTPBadRequest(explanation=e.message)
except exception.NotAuthorized, e:
raise webob.exc.HTTPUnauthorized()
return webob.Response(status_int=202)
@@ -162,7 +164,10 @@ class Floating_ips(extensions.ExtensionDescriptor):
floating_ip = self.network_api.get_floating_ip_by_ip(context, address)
if floating_ip.get('fixed_ip'):
self.network_api.disassociate_floating_ip(context, address)
try:
self.network_api.disassociate_floating_ip(context, address)
except exception.NotAuthorized, e:
raise webob.exc.HTTPUnauthorized()
return webob.Response(status_int=202)

View File

@@ -278,7 +278,7 @@ class FloatingIpTest(test.TestCase):
req.body = json.dumps(body)
req.headers["content-type"] = "application/json"
resp = req.get_response(fakes.wsgi_app())
self.assertEqual(resp.status_int, 400)
self.assertEqual(resp.status_int, 401)
def test_associate_floating_ip_to_instance_no_project_id(self):
def fake_fixed_ip_get_by_address(ctx, address, session=None):