Merge "Add list roles api to identity v3"

This commit is contained in:
Jenkins 2014-04-14 14:51:40 +00:00 committed by Gerrit Code Review
commit 4fa79ad475
3 changed files with 17 additions and 1 deletions

View File

@ -73,7 +73,7 @@ class RolesV3TestJSON(base.BaseIdentityV3AdminTest):
self.assertIn(role_id, fetched_role_ids)
@test.attr(type='smoke')
def test_role_create_update_get(self):
def test_role_create_update_get_list(self):
r_name = data_utils.rand_name('Role-')
resp, role = self.client.create_role(r_name)
self.addCleanup(self.client.delete_role, role['id'])
@ -94,6 +94,10 @@ class RolesV3TestJSON(base.BaseIdentityV3AdminTest):
self.assertEqual(new_name, new_role['name'])
self.assertEqual(updated_role['id'], new_role['id'])
resp, roles = self.client.list_roles()
self.assertEqual(resp['status'], '200')
self.assertIn(role['id'], [r['id'] for r in roles])
@test.attr(type='smoke')
def test_grant_list_revoke_role_to_user_on_project(self):
resp, _ = self.client.assign_user_role_on_project(

View File

@ -163,6 +163,12 @@ class IdentityV3ClientJSON(rest_client.RestClient):
body = json.loads(body)
return resp, body['role']
def list_roles(self):
"""Get the list of Roles."""
resp, body = self.get("roles")
body = json.loads(body)
return resp, body['roles']
def update_role(self, name, role_id):
"""Create a Role."""
post_body = {

View File

@ -217,6 +217,12 @@ class IdentityV3ClientXML(rest_client.RestClient):
body = self._parse_body(etree.fromstring(body))
return resp, body
def list_roles(self):
"""Get the list of Roles."""
resp, body = self.get("roles")
body = self._parse_roles(etree.fromstring(body))
return resp, body
def update_role(self, name, role_id):
"""Updates a Role."""
post_body = common.Element("role",