diff --git a/tests/functional/api/groups/members_test.py b/tests/functional/api/groups/members_test.py index 4e8217f8042..1d680c74248 100644 --- a/tests/functional/api/groups/members_test.py +++ b/tests/functional/api/groups/members_test.py @@ -53,24 +53,27 @@ def test_it_returns_list_of_members_if_user_has_access_to_private_group( ) assert res.status_code == 200 - assert res.json == [ - { - "authority": group.authority, - "userid": user.userid, - "username": user.username, - "display_name": user.display_name, - "roles": [GroupMembershipRoles.MEMBER], - "actions": ["delete"], - }, - { - "authority": group.authority, - "userid": other_user.userid, - "username": other_user.username, - "display_name": other_user.display_name, - "roles": [GroupMembershipRoles.MEMBER], - "actions": [], - }, - ] + assert res.json == sorted( + [ + { + "authority": group.authority, + "userid": user.userid, + "username": user.username, + "display_name": user.display_name, + "roles": [GroupMembershipRoles.MEMBER], + "actions": ["delete"], + }, + { + "authority": group.authority, + "userid": other_user.userid, + "username": other_user.username, + "display_name": other_user.display_name, + "roles": [GroupMembershipRoles.MEMBER], + "actions": [], + }, + ], + key=lambda membership: membership["username"], + ) def test_it_returns_404_if_user_does_not_have_read_access_to_group( self, app, db_session, factories