update floating ips tests
This commit is contained in:
@@ -144,6 +144,8 @@ class Floating_ips(extensions.ExtensionDescriptor):
|
|||||||
address)
|
address)
|
||||||
except exception.ApiError, e:
|
except exception.ApiError, e:
|
||||||
raise webob.exc.HTTPBadRequest(explanation=e.message)
|
raise webob.exc.HTTPBadRequest(explanation=e.message)
|
||||||
|
except exception.NotAuthorized, e:
|
||||||
|
raise webob.exc.HTTPUnauthorized()
|
||||||
|
|
||||||
return webob.Response(status_int=202)
|
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)
|
floating_ip = self.network_api.get_floating_ip_by_ip(context, address)
|
||||||
if floating_ip.get('fixed_ip'):
|
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)
|
return webob.Response(status_int=202)
|
||||||
|
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ class FloatingIpTest(test.TestCase):
|
|||||||
req.body = json.dumps(body)
|
req.body = json.dumps(body)
|
||||||
req.headers["content-type"] = "application/json"
|
req.headers["content-type"] = "application/json"
|
||||||
resp = req.get_response(fakes.wsgi_app())
|
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 test_associate_floating_ip_to_instance_no_project_id(self):
|
||||||
def fake_fixed_ip_get_by_address(ctx, address, session=None):
|
def fake_fixed_ip_get_by_address(ctx, address, session=None):
|
||||||
|
|||||||
Reference in New Issue
Block a user