Skip to content

Commit

Permalink
Merge pull request #91 from rackerlabs/fix-issue-74
Browse files Browse the repository at this point in the history
fix for issue #74 - default identity role to be user-admin
  • Loading branch information
lekhajee committed Oct 17, 2014
2 parents 1a06635 + bd729ef commit ff38183
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mimic/canned_responses/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@

HARD_CODED_TOKEN = "fff73937db5047b8b12fc9691ea5b9e8"
HARD_CODED_USER_ID = "10002"
HARD_CODED_USER_NAME = "autoscaleaus"
HARD_CODED_ROLES = [{"id": "1", "description": "Admin", "name": "Identity"}]
HARD_CODED_USER_NAME = "mimictestuser"
HARD_CODED_ROLES = [{"id": "3", "description": "User Admin Role.",
"name": "identity:user-admin"}]


def format_timestamp(dt):
Expand Down
23 changes: 23 additions & 0 deletions mimic/test/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,29 @@ def test_response_has_auth_token(self):
self.assertEqual(token, session.token)
self.assertEqual(tenant_id, session.tenant_id)

def test_response_has_user_admin_identity_role(self):
"""
The JSON response for authenticate has the role `identity:user-admin`.
"""
core = MimicCore(Clock(), [])
root = MimicRoot(core).app.resource()

(response, json_body) = self.successResultOf(json_request(
self, root, "POST", "/identity/v2.0/tokens",
{
"auth": {
"passwordCredentials": {
"username": "demoauthor",
"password": "theUsersPassword"
}

}
}
))

self.assertEqual(200, response.code)
self.assertEqual(json_body['access']['user']['roles'], HARD_CODED_ROLES)

def test_auth_accepts_tenant_name(self):
"""
If "tenantName" is passed, the tenant specified is used instead of a
Expand Down

0 comments on commit ff38183

Please sign in to comment.