Get user role without project id is not implemented
The router for getting user's role without project id is defined for V2 API but not implemented so far, this change will make it explicitly show that this http request is not implemented. Co-Authored-By: Dave Chen <wei.d.chen@intel.com> Closes-Bug: #1507920 Change-Id: Iae710915a912558057b942d3ca62ab380ce26003
This commit is contained in:
parent
93239e455c
commit
dc4dd4b81b
|
@ -138,6 +138,11 @@ class RoleAssignmentV2(controller.V2Controller):
|
|||
|
||||
"""
|
||||
self.assert_admin(context)
|
||||
# NOTE(davechen): Router without project id is defined,
|
||||
# but we don't plan on implementing this.
|
||||
if tenant_id is None:
|
||||
raise exception.NotImplemented(
|
||||
message=_('User roles not supported: tenant_id required'))
|
||||
roles = self.assignment_api.get_roles_for_user_and_project(
|
||||
user_id, tenant_id)
|
||||
return {'roles': [self.role_api.get_role(x)
|
||||
|
|
|
@ -273,6 +273,14 @@ class CoreApiTests(object):
|
|||
token=token)
|
||||
self.assertValidRoleListResponse(r)
|
||||
|
||||
def test_get_user_roles_without_tenant(self):
|
||||
token = self.get_scoped_token()
|
||||
self.admin_request(
|
||||
path='/v2.0/users/%(user_id)s/roles' % {
|
||||
'user_id': self.user_foo['id'],
|
||||
},
|
||||
token=token, expected_status=http_client.NOT_IMPLEMENTED)
|
||||
|
||||
def test_get_user(self):
|
||||
token = self.get_scoped_token()
|
||||
r = self.admin_request(
|
||||
|
|
Loading…
Reference in New Issue