From 24eaa68d2cd535bfb4b5db9c54c67d1d806b2564 Mon Sep 17 00:00:00 2001 From: "Kevin L. Mitchell" Date: Thu, 2 Jun 2011 11:01:08 -0500 Subject: 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. --- test/functional/test_tokens.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'test') 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): -- cgit