Merge "Change exception type from HTTPBadRequest to HTTPForbidden"
This commit is contained in:
@@ -233,7 +233,7 @@ class ServersController(wsgi.Controller):
|
|||||||
search_opts['deleted'] = True
|
search_opts['deleted'] = True
|
||||||
else:
|
else:
|
||||||
msg = _("Only administrators may list deleted instances")
|
msg = _("Only administrators may list deleted instances")
|
||||||
raise exc.HTTPBadRequest(explanation=msg)
|
raise exc.HTTPForbidden(explanation=msg)
|
||||||
|
|
||||||
# If tenant_id is passed as a search parameter this should
|
# If tenant_id is passed as a search parameter this should
|
||||||
# imply that all_tenants is also enabled unless explicitly
|
# imply that all_tenants is also enabled unless explicitly
|
||||||
|
|||||||
@@ -569,7 +569,7 @@ class Controller(wsgi.Controller):
|
|||||||
search_opts['deleted'] = True
|
search_opts['deleted'] = True
|
||||||
else:
|
else:
|
||||||
msg = _("Only administrators may list deleted instances")
|
msg = _("Only administrators may list deleted instances")
|
||||||
raise exc.HTTPBadRequest(explanation=msg)
|
raise exc.HTTPForbidden(explanation=msg)
|
||||||
|
|
||||||
# If all tenants is passed with 0 or false as the value
|
# If all tenants is passed with 0 or false as the value
|
||||||
# then remove it from the search options. Nothing passed as
|
# then remove it from the search options. Nothing passed as
|
||||||
|
|||||||
@@ -1012,7 +1012,7 @@ class ServersControllerTest(ControllerTest):
|
|||||||
def test_get_servers_deleted_status_as_user(self):
|
def test_get_servers_deleted_status_as_user(self):
|
||||||
req = fakes.HTTPRequestV3.blank('/servers?status=deleted',
|
req = fakes.HTTPRequestV3.blank('/servers?status=deleted',
|
||||||
use_admin_context=False)
|
use_admin_context=False)
|
||||||
self.assertRaises(webob.exc.HTTPBadRequest,
|
self.assertRaises(webob.exc.HTTPForbidden,
|
||||||
self.controller.detail, req)
|
self.controller.detail, req)
|
||||||
|
|
||||||
def test_get_servers_deleted_status_as_admin(self):
|
def test_get_servers_deleted_status_as_admin(self):
|
||||||
|
|||||||
@@ -932,7 +932,7 @@ class ServersControllerTest(ControllerTest):
|
|||||||
def test_get_servers_deleted_status_as_user(self):
|
def test_get_servers_deleted_status_as_user(self):
|
||||||
req = fakes.HTTPRequest.blank('/fake/servers?status=deleted',
|
req = fakes.HTTPRequest.blank('/fake/servers?status=deleted',
|
||||||
use_admin_context=False)
|
use_admin_context=False)
|
||||||
self.assertRaises(webob.exc.HTTPBadRequest,
|
self.assertRaises(webob.exc.HTTPForbidden,
|
||||||
self.controller.detail, req)
|
self.controller.detail, req)
|
||||||
|
|
||||||
def test_get_servers_deleted_status_as_admin(self):
|
def test_get_servers_deleted_status_as_admin(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user