summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin L. Mitchell <kevin.mitchell@rackspace.com>2011-06-02 11:01:08 -0500
committerKevin L. Mitchell <kevin.mitchell@rackspace.com>2011-06-02 11:01:08 -0500
commit24eaa68d2cd535bfb4b5db9c54c67d1d806b2564 (patch)
tree6a58b1406a37d23633631e7803e9156444d97053
parent400dbe888b90d4bfac7a0b5379987fbb20974d05 (diff)
It's possible to authenticate through the Admin API.
Note: Had to add more dependencies because Keystone returns extant tokens, so we have to be very careful about ordering of token revocations. This shouldn't affect anything that extends base.KeystoneTest--all that can still run in parallel--but the test_adminauth() has to be a dependency of base.KeystoneTest.setUpClass() and has to be dependent on test_authenticate() so we serialize things properly.
-rw-r--r--test/functional/test_tokens.py25
1 files changed, 24 insertions, 1 deletions
diff --git a/test/functional/test_tokens.py b/test/functional/test_tokens.py
index f28b5e90..a30c4c9a 100644
--- a/test/functional/test_tokens.py
+++ b/test/functional/test_tokens.py
@@ -44,9 +44,32 @@ class AuthenticateTest(base.BaseKeystoneTest):
resp = self.ks_admin.revoke_token(admin_tok, admin_tok)
util.assert_equal(resp.status, 204)
+ @dtest.depends(test_authenticate)
+ def test_adminauth(self):
+ """Test that we can authenticate using Keystone Admin API."""
+
+ # Issue the authentication request
+ resp = self.ks_admin.authenticate(base.options.adminuser,
+ base.options.adminpass)
+
+ # Verify that resp is correct
+ util.assert_equal(resp.status, 200)
+ util.assert_in('auth', resp.obj)
+ util.assert_in('token', resp.obj['auth'])
+ util.assert_in('expires', resp.obj['auth']['token'])
+ util.assert_in('id', resp.obj['auth']['token'])
+
+ # Squirrel away the admin token ID
+ admin_tok = resp.obj['auth']['token']['id']
+
+ # Now ensure we can revoke an authentication token
+ resp = self.ks_admin.revoke_token(admin_tok, admin_tok)
+ util.assert_equal(resp.status, 204)
+
# Ensure that all remaining tests wait for test_authenticate
-dtest.depends(AuthenticateTest.test_authenticate)(base.KeystoneTest.setUpClass)
+dtest.depends(AuthenticateTest.test_authenticate,
+ AuthenticateTest.test_adminauth)(base.KeystoneTest.setUpClass)
class ValidateTest(base.KeystoneTest):