diff options
author | Dolph Mathews <dolph.mathews@gmail.com> | 2013-05-09 10:06:35 -0500 |
---|---|---|
committer | Dolph Mathews <dolph.mathews@gmail.com> | 2013-05-09 10:06:35 -0500 |
commit | 678b06a91f772d6be82eb54ed11f27e20f446b57 (patch) | |
tree | 1c25498c3b0e9e1d32ce7becbb6b4d87720f6118 /tests/test_keystoneclient.py | |
parent | b874c8f581fd5fb1e6657f9ec9348076e34a3849 (diff) | |
download | keystone-2013.1.1.tar.gz |
Revoke tokens on user delete (bug 1166670)2013.1.1
Change-Id: Id8a2972c9adb572ef9d2b7f03bcf07a8de5614ab
Diffstat (limited to 'tests/test_keystoneclient.py')
-rw-r--r-- | tests/test_keystoneclient.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_keystoneclient.py b/tests/test_keystoneclient.py index dd7dc1d7d..f0ca1b314 100644 --- a/tests/test_keystoneclient.py +++ b/tests/test_keystoneclient.py @@ -396,6 +396,30 @@ class KeystoneClientTests(object): self.get_client, self.user_foo) + def test_delete_user_invalidates_token(self): + from keystoneclient import exceptions as client_exceptions + + admin_client = self.get_client(admin=True) + client = self.get_client(admin=False) + + username = uuid.uuid4().hex + password = uuid.uuid4().hex + user_id = admin_client.users.create( + name=username, password=password, email=uuid.uuid4().hex).id + + token_id = client.tokens.authenticate( + username=username, password=password).id + + # token should be usable before the user is deleted + client.tokens.authenticate(token=token_id) + + admin_client.users.delete(user=user_id) + + # authenticate with a token should not work after the user is deleted + self.assertRaises(client_exceptions.Unauthorized, + client.tokens.authenticate, + token=token_id) + def test_token_expiry_maintained(self): foo_client = self.get_client(self.user_foo) |