summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-01-26 07:27:26 +0000
committerGerrit Code Review <review@openstack.org>2012-01-26 07:27:26 +0000
commitfacd8951f7ca4e3dd613d70aba855d6800d89922 (patch)
tree9d179766b219dd18278f308a0e45e917ea989419
parent32a6f499b8a5d5fc3e2d7ff29d0c8e8fbf9e1a23 (diff)
parent6fdd1f6215756422068ad112509de5d7be057373 (diff)
downloadnova-essex-3.tar.gz
Merge "Return 403 instead of 401 when policies reject" into milestone-proposedessex-3
-rw-r--r--nova/api/openstack/wsgi.py2
-rw-r--r--nova/tests/api/openstack/compute/contrib/test_simple_tenant_usage.py2
-rw-r--r--nova/tests/api/openstack/test_wsgi.py2
3 files changed, 3 insertions, 3 deletions
diff --git a/nova/api/openstack/wsgi.py b/nova/api/openstack/wsgi.py
index 8a7a077b8f..26f6cc97f4 100644
--- a/nova/api/openstack/wsgi.py
+++ b/nova/api/openstack/wsgi.py
@@ -573,7 +573,7 @@ class ResourceExceptionHandler(object):
if isinstance(ex_value, exception.NotAuthorized):
msg = unicode(ex_value)
- raise Fault(webob.exc.HTTPUnauthorized(explanation=msg))
+ raise Fault(webob.exc.HTTPForbidden(explanation=msg))
elif isinstance(ex_value, TypeError):
LOG.exception(ex_value)
raise Fault(webob.exc.HTTPBadRequest())
diff --git a/nova/tests/api/openstack/compute/contrib/test_simple_tenant_usage.py b/nova/tests/api/openstack/compute/contrib/test_simple_tenant_usage.py
index 18514c433d..afb4e5fccc 100644
--- a/nova/tests/api/openstack/compute/contrib/test_simple_tenant_usage.py
+++ b/nova/tests/api/openstack/compute/contrib/test_simple_tenant_usage.py
@@ -174,7 +174,7 @@ class SimpleTenantUsageTest(test.TestCase):
try:
res = req.get_response(fakes.wsgi_app(
fake_auth_context=self.alt_user_context))
- self.assertEqual(res.status_int, 401)
+ self.assertEqual(res.status_int, 403)
finally:
policy.reset()
diff --git a/nova/tests/api/openstack/test_wsgi.py b/nova/tests/api/openstack/test_wsgi.py
index 3dfcb23880..3974971fab 100644
--- a/nova/tests/api/openstack/test_wsgi.py
+++ b/nova/tests/api/openstack/test_wsgi.py
@@ -204,7 +204,7 @@ class ResourceTest(test.TestCase):
req = webob.Request.blank('/tests')
app = fakes.TestRouter(Controller())
response = req.get_response(app)
- self.assertEqual(response.status_int, 401)
+ self.assertEqual(response.status_int, 403)
def test_dispatch(self):
class Controller(object):