From ad9ac0c6dce5b2a8da72bb4860a353aeb0bd09d9 Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Wed, 11 Jul 2012 14:57:55 -0400 Subject: 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 --- nova/tests/api/test_auth.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'nova/tests') 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') -- cgit