Merge "Add fetch revocations for v2.0"

This commit is contained in:
Jenkins
2015-01-28 20:00:12 +00:00
committed by Gerrit Code Review
2 changed files with 17 additions and 0 deletions

View File

@@ -160,3 +160,10 @@ class TokenTests(utils.TestCase):
self.assertIsInstance(token_ref, tokens.Token)
self.assertEqual(token_fixture.token_id, token_ref.id)
self.assertEqual(token_fixture.expires_str, token_ref.expires)
def test_get_revoked(self):
sample_revoked_response = {'signed': '-----BEGIN CMS-----\nMIIB...'}
self.stub_url('GET', ['tokens', 'revoked'],
json=sample_revoked_response)
resp = self.client.tokens.get_revoked()
self.assertEqual(sample_revoked_response, resp)

View File

@@ -72,3 +72,13 @@ class TokenManager(base.Manager):
def endpoints(self, token):
return self._get("/tokens/%s/endpoints" % base.getid(token), "token")
def get_revoked(self):
"""Returns the revoked tokens response.
The response will be a dict containing 'signed' which is a CMS-encoded
document.
"""
resp, body = self.client.get('/tokens/revoked')
return body