summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorKevin L. Mitchell <kevin.mitchell@rackspace.com>2011-06-01 14:32:20 -0500
committerKevin L. Mitchell <kevin.mitchell@rackspace.com>2011-06-01 14:32:20 -0500
commit642922d8d3e3b8f3e5935d39559baab2cbd46fcf (patch)
treee251d22c60d7b75f157011ff0ec5dde7e5654f48 /test
parenta8758d92072955fa3f7112b6a8b25ec7b238a689 (diff)
Add test for validate_token
Diffstat (limited to 'test')
-rw-r--r--test/functional/test_tokens.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/functional/test_tokens.py b/test/functional/test_tokens.py
index a84eed02..f28b5e90 100644
--- a/test/functional/test_tokens.py
+++ b/test/functional/test_tokens.py
@@ -47,3 +47,25 @@ class AuthenticateTest(base.BaseKeystoneTest):
# Ensure that all remaining tests wait for test_authenticate
dtest.depends(AuthenticateTest.test_authenticate)(base.KeystoneTest.setUpClass)
+
+
+class ValidateTest(base.KeystoneTest):
+ def test_validate(self):
+ """Test that we can validate tokens using Keystone."""
+
+ # Issue the validation request
+ resp = self.ks_admin.validate_token(self.admin_tok, self.user_tok)
+
+ # 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_equal(resp.obj['auth']['token']['expires'],
+ self.user_expire)
+ util.assert_in('id', resp.obj['auth']['token'])
+ util.assert_equal(resp.obj['auth']['token']['id'], self.user_tok)
+ util.assert_in('user', resp.obj['auth'])
+ util.assert_in('username', resp.obj['auth']['user'])
+ util.assert_equal(resp.obj['auth']['user']['username'],
+ base.options.username)