Add fetch revocations for v2.0

There was no API to fetch revocations using v2.0.

bp auth-token-use-client

Change-Id: Ica5aae5b9075180223268fb6b2ef11e00dfd057f
This commit is contained in:
Brant Knudson
2014-12-15 17:19:03 -06:00
parent 81e48d44ff
commit 979b3fc495
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