summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-03-23 18:58:29 +0000
committerGerrit Code Review <review@openstack.org>2012-03-23 18:58:29 +0000
commit112af23d623cbbd68bf6e09a6e507170c57abe6b (patch)
treec561104876cce24c7270f0a29c21c9883f2cc014 /nova/tests
parenta5088664a7e433be15bac6405f361513aeacfe06 (diff)
parent71172ac4bb190496c4ef668c3cba6fa9bf5834aa (diff)
Merge "Send a more appropriate error response for 403 in osapi"
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/api/openstack/test_faults.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/nova/tests/api/openstack/test_faults.py b/nova/tests/api/openstack/test_faults.py
index 96a62017b..3eb2bb8dc 100644
--- a/nova/tests/api/openstack/test_faults.py
+++ b/nova/tests/api/openstack/test_faults.py
@@ -96,6 +96,19 @@ class TestFaults(test.TestCase):
self.assertEqual(resp.status_int, 404)
self.assertTrue('whut?' in resp.body)
+ def test_raise_403(self):
+ """Ensure the ability to raise :class:`Fault` in WSGI-ified methods."""
+ @webob.dec.wsgify
+ def raiser(req):
+ raise wsgi.Fault(webob.exc.HTTPForbidden(explanation='whut?'))
+
+ req = webob.Request.blank('/.xml')
+ resp = req.get_response(raiser)
+ self.assertEqual(resp.content_type, "application/xml")
+ self.assertEqual(resp.status_int, 403)
+ self.assertTrue('resizeNotAllowed' not in resp.body)
+ self.assertTrue('forbidden' in resp.body)
+
def test_fault_has_status_int(self):
"""Ensure the status_int is set correctly on faults"""
fault = wsgi.Fault(webob.exc.HTTPBadRequest(explanation='what?'))