Support roles 'name' in list_roles call
Change-Id: Ia615288da30426c2f689daa3e5f88376aead1d3f
This commit is contained in:
parent
eefd1609ac
commit
658b5805be
@ -1061,7 +1061,7 @@ class IdentityCloudMixin(_normalize.Normalizer):
|
||||
self.list_groups.invalidate(self)
|
||||
return True
|
||||
|
||||
@_utils.valid_kwargs('domain_id')
|
||||
@_utils.valid_kwargs('domain_id', 'name')
|
||||
def list_roles(self, **kwargs):
|
||||
"""List Keystone roles.
|
||||
|
||||
|
@ -54,6 +54,22 @@ class TestIdentityRoles(base.TestCase):
|
||||
self.cloud.list_roles()
|
||||
self.assert_calls()
|
||||
|
||||
def test_list_role_by_name(self):
|
||||
role_data = self._get_role_data()
|
||||
self.register_uris([
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(
|
||||
qs_elements=['name={0}'.format(role_data.role_name)]),
|
||||
status_code=200,
|
||||
json={'roles': [role_data.json_response['role']]})
|
||||
])
|
||||
role = self.cloud.list_roles(name=role_data.role_name)[0]
|
||||
|
||||
self.assertIsNotNone(role)
|
||||
self.assertThat(role.id, matchers.Equals(role_data.role_id))
|
||||
self.assertThat(role.name, matchers.Equals(role_data.role_name))
|
||||
self.assert_calls()
|
||||
|
||||
def test_get_role_by_name(self):
|
||||
role_data = self._get_role_data()
|
||||
self.register_uris([
|
||||
|
Loading…
Reference in New Issue
Block a user