summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorDan Prince <dprince@redhat.com>2012-07-11 14:57:55 -0400
committerDan Prince <dprince@redhat.com>2012-07-12 14:44:26 -0400
commitad9ac0c6dce5b2a8da72bb4860a353aeb0bd09d9 (patch)
treed19a542ed5ed698d601c151ac15c2e4d93f61dff /nova/tests
parent31dfb9736cf73df3c0a86d0505bce3e1aae3a8f9 (diff)
Raise HTTP 500 if service catalog is not json.
Updates the Nova API auth middleware so that it returns a HTTP 500 error if invalid JSON is found. Adds a unit test. Change-Id: I236ced13bac2164e103060e78845a410ceb6cdd4
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/api/test_auth.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/nova/tests/api/test_auth.py b/nova/tests/api/test_auth.py
index e937da541..c77bcfa55 100644
--- a/nova/tests/api/test_auth.py
+++ b/nova/tests/api/test_auth.py
@@ -58,3 +58,9 @@ class TestNovaKeystoneContextMiddleware(test.TestCase):
response = self.request.get_response(self.middleware)
self.assertEqual(response.status, '200 OK')
self.assertEqual(self.context.user_id, 'testuserid')
+
+ def test_invalid_service_catalog(self):
+ self.request.headers['X_USER'] = 'testuser'
+ self.request.headers['X_SERVICE_CATALOG'] = "bad json"
+ response = self.request.get_response(self.middleware)
+ self.assertEqual(response.status, '500 Internal Server Error')