change return type to list of dicts
This commit is contained in:
parent
a3f4ea5d44
commit
cb6da5074c
2 changed files with 6 additions and 4 deletions
|
|
@ -13419,13 +13419,15 @@ class RootExports(object):
|
|||
- name: User's name
|
||||
- krb_principal: Kerberos principal
|
||||
|
||||
:returns: a dict mapping member's group IDs to group names
|
||||
:returns: a list of dicts, each containing the id and name of
|
||||
a group
|
||||
|
||||
:raises: GenericError if the specified user is not found
|
||||
"""
|
||||
|
||||
uinfo = get_user(user, strict=True)
|
||||
return get_user_groups(uinfo["id"])
|
||||
return [{'id': key, 'name': val} for key, val in
|
||||
get_user_groups(uinfo["id"]).items()]
|
||||
|
||||
def listUsers(self, userType=koji.USERTYPES['NORMAL'], prefix=None, queryOpts=None, perm=None,
|
||||
inherited_perm=False):
|
||||
|
|
|
|||
|
|
@ -48,5 +48,5 @@ class TestGetUserGroups(DBQueryTestCase):
|
|||
'user_id': 23})
|
||||
self.assertEqual(query.columns, ['group_id', 'name'])
|
||||
|
||||
self.assertEqual(grps, {123: 'grp_123',
|
||||
456: 'grp_456'})
|
||||
self.assertEqual(grps, [{'id': 123, 'name': 'grp_123'},
|
||||
{'id': 456, 'name': 'grp_456'}])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue