diff options
| author | Jay Pipes <jaypipes@gmail.com> | 2011-06-05 12:56:34 -0400 |
|---|---|---|
| committer | Jay Pipes <jaypipes@gmail.com> | 2011-06-05 12:56:34 -0400 |
| commit | 7cc8c6cbc1e1c19d1704e9bda25b6a2da8097bd5 (patch) | |
| tree | a3c126c175f9441e8616b5b1205507bd0b92c81e | |
| parent | dff1d9db40ade13523d92b922f932f67b819200b (diff) | |
| download | keystone-7cc8c6cbc1e1c19d1704e9bda25b6a2da8097bd5.tar.gz keystone-7cc8c6cbc1e1c19d1704e9bda25b6a2da8097bd5.tar.xz keystone-7cc8c6cbc1e1c19d1704e9bda25b6a2da8097bd5.zip | |
Add test verifying a missing tenantId key in the password creds works properly in JSON
| -rw-r--r-- | test/unit/test_authn_v2.py | 36 |
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 } |
