summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDolph Mathews <dolph.mathews@gmail.com>2015-06-11 22:27:06 +0000
committerDolph Mathews <dolph.mathews@gmail.com>2015-08-25 13:08:06 +0000
commit385877d3b7a4339dbc90d3d70de6ff30184db986 (patch)
tree4c52d681c2d1ea66ffcb78a8aee8dc486a62ab6f
parentec59d49e5f4941fe1d5f08f3b4870ea601910128 (diff)
downloadkeystone-385877d3b7a4339dbc90d3d70de6ff30184db986.tar.gz
Test v2 tokens being deleted by v3
This test illustrates that v2 tokens deleted by v3 do not work on v2. Change-Id: Ia87fc785afe624fde0ad191cc6f031eb7605096e Related-Bug: 1464377 (cherry picked from commit 0941a5e46391bfeecac1247d12604fcb78047cb7)
-rw-r--r--keystone/tests/unit/test_v3_auth.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/keystone/tests/unit/test_v3_auth.py b/keystone/tests/unit/test_v3_auth.py
index dd272f5f7..003a8e77d 100644
--- a/keystone/tests/unit/test_v3_auth.py
+++ b/keystone/tests/unit/test_v3_auth.py
@@ -326,6 +326,31 @@ class TokenAPITests(object):
self.assertEqual(v2_issued_at, v3_issued_at)
+ def test_v2_token_deleted_on_v3(self):
+ # Create a v2 token.
+ body = {
+ 'auth': {
+ 'passwordCredentials': {
+ 'userId': self.default_domain_user['id'],
+ 'password': self.default_domain_user['password']
+ },
+ 'tenantId': self.default_domain_project['id']
+ }
+ }
+ r = self.admin_request(
+ path='/v2.0/tokens', method='POST', body=body)
+ v2_token = r.result['access']['token']['id']
+
+ # Delete the v2 token using v3.
+ resp = self.delete(
+ '/auth/tokens', headers={'X-Subject-Token': v2_token})
+ self.assertEqual(resp.status_code, 204)
+
+ # Attempting to use the deleted token on v2 should fail.
+ self.admin_request(
+ path='/v2.0/tenants', method='GET', token=v2_token,
+ expected_status=401)
+
def test_rescoping_token(self):
expires = self.token_data['token']['expires_at']
auth_data = self.build_authentication_request(