diff options
author | Adam Young <ayoung@redhat.com> | 2012-08-17 19:17:17 -0400 |
---|---|---|
committer | Adam Young <ayoung@redhat.com> | 2012-08-23 10:51:20 -0400 |
commit | 3fa4ba537e7d297aeb63554231d041da7ad2476f (patch) | |
tree | a68af65cb931573bdea07fd4d993eb641fa216cb /tests/test_content_types.py | |
parent | f20cfbf34ea0667996e7dc918f6c453ad1bd81ad (diff) | |
download | keystone-3fa4ba537e7d297aeb63554231d041da7ad2476f.tar.gz keystone-3fa4ba537e7d297aeb63554231d041da7ad2476f.tar.xz keystone-3fa4ba537e7d297aeb63554231d041da7ad2476f.zip |
Fix auth_token middleware to fetch revocation list as admin.
Make the revocation list into a JSON document and get the Vary header.
This will also allow the revocation list to carry additional
information in the future, to include sufficient information for the
calling application to figure out how to get the certificates it
requires.
Bug 1038309
Change-Id: I4a41cbd8a7352e5b5f951027d6f2063b169bce89
Diffstat (limited to 'tests/test_content_types.py')
-rw-r--r-- | tests/test_content_types.py | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/tests/test_content_types.py b/tests/test_content_types.py index ba8d2a28..bd17f173 100644 --- a/tests/test_content_types.py +++ b/tests/test_content_types.py @@ -220,11 +220,15 @@ class RestfulTestCase(test.TestCase): def public_request(self, port=None, **kwargs): kwargs['port'] = port or self._public_port() - return self.restful_request(**kwargs) + response = self.restful_request(**kwargs) + self.assertValidResponseHeaders(response) + return response def admin_request(self, port=None, **kwargs): kwargs['port'] = port or self._admin_port() - return self.restful_request(**kwargs) + response = self.restful_request(**kwargs) + self.assertValidResponseHeaders(response) + return response def get_scoped_token(self): """Convenience method so that we can test authenticated requests.""" @@ -621,6 +625,25 @@ class JsonTestCase(RestfulTestCase, CoreApiTests): r = self.admin_request(path=path, expected_status=401) self.assertValidErrorResponse(r) + def test_fetch_revocation_list_nonadmin_fails(self): + r = self.admin_request( + method='GET', + path='/v2.0/tokens/revoked', + expected_status=401) + + def test_fetch_revocation_list_admin_200(self): + token = self.get_scoped_token() + r = self.restful_request( + method='GET', + path='/v2.0/tokens/revoked', + token=token, + expected_status=200, + port=self._admin_port()) + self.assertValidRevocationListResponse(r) + + def assertValidRevocationListResponse(self, response): + self.assertIsNotNone(response.body['signed']) + class XmlTestCase(RestfulTestCase, CoreApiTests): xmlns = 'http://docs.openstack.org/identity/api/v2.0' |