diff options
Diffstat (limited to 'tests/unit/auth/test_privileges.py')
-rw-r--r-- | tests/unit/auth/test_privileges.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/unit/auth/test_privileges.py b/tests/unit/auth/test_privileges.py index 8395293..4894dfc 100644 --- a/tests/unit/auth/test_privileges.py +++ b/tests/unit/auth/test_privileges.py @@ -6,7 +6,9 @@ from gn3.auth.authorisation.privileges import Privilege, user_privileges from tests.unit.auth import conftest -SORT_KEY = lambda x: x.privilege_id +def sort_key(priv): + """Return the key to sort by""" + return priv.privilege_id PRIVILEGES = sorted( (Privilege("system:group:create-group", "Create a group"), @@ -29,7 +31,7 @@ PRIVILEGES = sorted( Privilege("group:role:edit-role", "edit/update an existing role"), Privilege("group:user:assign-role", "Assign a role to an existing user"), Privilege("group:role:delete-role", "Delete an existing role")), - key=SORT_KEY) + key=sort_key) @pytest.mark.unit_test @pytest.mark.parametrize( @@ -43,4 +45,4 @@ def test_user_privileges(auth_testdb_path, fxtr_users, user, expected):# pylint: """ with db.connection(auth_testdb_path) as conn: assert sorted( - user_privileges(conn, user), key=SORT_KEY) == expected + user_privileges(conn, user), key=sort_key) == expected |