aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/auth/fixtures
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-09-15 08:38:47 +0300
committerFrederick Muriuki Muriithi2023-09-26 03:44:31 +0300
commitf6566c76d97cb44d47cc491f13e1342f0c2555cf (patch)
treed46f8d05cfd78ddda1f0549e65dc07ae233d2f7e /tests/unit/auth/fixtures
parente19b01571ce61e01f482a1dadeeb2fd835fda939 (diff)
downloadgn-auth-f6566c76d97cb44d47cc491f13e1342f0c2555cf.tar.gz
Update `user_roles`: Return roles for user by resource.
Diffstat (limited to 'tests/unit/auth/fixtures')
-rw-r--r--tests/unit/auth/fixtures/group_fixtures.py7
-rw-r--r--tests/unit/auth/fixtures/migration_fixtures.py5
2 files changed, 10 insertions, 2 deletions
diff --git a/tests/unit/auth/fixtures/group_fixtures.py b/tests/unit/auth/fixtures/group_fixtures.py
index 66edf5e..93133d2 100644
--- a/tests/unit/auth/fixtures/group_fixtures.py
+++ b/tests/unit/auth/fixtures/group_fixtures.py
@@ -21,11 +21,14 @@ GROUP_CATEGORY = ResourceCategory(
"A group resource.")
GROUPS_AS_RESOURCES = tuple({
"group_id": str(group.group_id),
- "resource_id": str(uuid.uuid4()),
+ "resource_id": res_id,
"resource_name": group.group_name,
"category_id": str(GROUP_CATEGORY.resource_category_id),
"public": "1"
-} for group in TEST_GROUPS)
+} for res_id, group in zip(
+ ("38d1807d-105f-44a7-8327-7e2d973b6d8d",
+ "89458ef6-e090-4b53-8c2c-59eaf2785f11"),
+ TEST_GROUPS))
TEST_RESOURCES_GROUP_01 = (
Resource(uuid.UUID("26ad1668-29f5-439d-b905-84d551f85955"),
diff --git a/tests/unit/auth/fixtures/migration_fixtures.py b/tests/unit/auth/fixtures/migration_fixtures.py
index 16a31cd..954b5a9 100644
--- a/tests/unit/auth/fixtures/migration_fixtures.py
+++ b/tests/unit/auth/fixtures/migration_fixtures.py
@@ -40,6 +40,11 @@ def conn_after_auth_migrations(backend, auth_testdb_path, all_migrations): # pyl
"""Run all migrations and return a connection to the database after"""
apply_migrations(backend, all_migrations)
with db.connection(auth_testdb_path) as conn:
+ with db.cursor(conn) as cursor:
+ cursor.execute(
+ "UPDATE resources "
+ "SET resource_id='0248b289-b277-4eaa-8c94-88a434d14b6e' "
+ "WHERE resource_name='GeneNetwork System'")
yield conn
rollback_migrations(backend, all_migrations)