aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/auth/test_privileges.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-07-10 11:36:47 +0300
committerFrederick Muriuki Muriithi2023-07-10 11:36:47 +0300
commitc6ac30d4ccc26553a12e8c37cdf9078cbe9084b3 (patch)
treea40cea1c2b129e0e37b70d42c6f87fe51a5ec178 /tests/unit/auth/test_privileges.py
parentedebea34ac6545909737ce9540e9d51858550873 (diff)
downloadgenenetwork3-migrate-to-python3.10.tar.gz
Fix linting errors caused by bump to Python 3.10migrate-to-python3.10
Diffstat (limited to 'tests/unit/auth/test_privileges.py')
-rw-r--r--tests/unit/auth/test_privileges.py8
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