summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJay Pipes <jaypipes@gmail.com>2011-06-06 00:56:34 +0800
committerKevin L. Mitchell <kevin.mitchell@rackspace.com>2011-06-10 04:30:06 +0800
commit319beab20466e2d33deea5136f912e83cdb7b78a (patch)
tree5f6bf9032e2762fd7022f4e88767bbd5c3b96e2f /test
parent932c67002f483ff3a8ab0c82a5475dbf02ed17f8 (diff)
Add test verifying a missing tenantId key in the password creds works properly in JSON
Diffstat (limited to 'test')
-rw-r--r--test/unit/test_authn_v2.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/unit/test_authn_v2.py b/test/unit/test_authn_v2.py
index 284cb7b6..2ec2e07a 100644
--- a/test/unit/test_authn_v2.py
+++ b/test/unit/test_authn_v2.py
@@ -96,6 +96,42 @@ class TestAuthnV2(base.ServiceAPITest):
body = {
"passwordCredentials": {
"username": self.auth_user['id'],
+ "password": self.auth_user['password']
+ }
+ }
+ req.body = json.dumps(body)
+ self.get_response()
+ self.status_ok()
+
+ expected = {
+ u'auth': {
+ u'token': {
+ u'expires': self.expires.strftime("%Y-%m-%dT%H:%M:%S.%f"),
+ u'id': 'NOTENANTTOKEN'
+ }
+ }
+ }
+ self.assert_dict_equal(expected, json.loads(self.res.body))
+
+ @jsonify
+ def test_success_none_tenant_json(self):
+ """
+ Test that supplying an existing user/pass, with a tenant ID of None
+ in the password credentials results in a 200 OK but a token not
+ matching the token with a tenant attached to it.
+ """
+ # Create a special token for user with no tenant
+ auth_token = self.fixture_create_token(
+ user_id=self.auth_user['id'],
+ tenant_id=None,
+ expires=self.expires,
+ token_id='NOTENANTTOKEN')
+
+ url = "/tokens"
+ req = self.get_request('POST', url)
+ body = {
+ "passwordCredentials": {
+ "username": self.auth_user['id'],
"password": self.auth_user['password'],
"tenantId": None
}