aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/auth/fixtures/user_fixtures.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-06-20 15:34:02 -0500
committerFrederick Muriuki Muriithi2024-06-20 15:34:02 -0500
commitc0f5b9d646487e035f2d2e5370041b317b81baf6 (patch)
treee1cce317553a2379aa1717d700ded55ca9418440 /tests/unit/auth/fixtures/user_fixtures.py
parent8e460b05da4d419aa1b53b1c639d3e370143de4f (diff)
downloadgn-auth-c0f5b9d646487e035f2d2e5370041b317b81baf6.tar.gz
Reorganise test fixtures. Fix tests and issues caught.
Reorganise test fixtures to more closely follow the design of the auth system. Fix the broken tests due to refactors and fix all issues caught by the running tests.
Diffstat (limited to 'tests/unit/auth/fixtures/user_fixtures.py')
-rw-r--r--tests/unit/auth/fixtures/user_fixtures.py25
1 files changed, 0 insertions, 25 deletions
diff --git a/tests/unit/auth/fixtures/user_fixtures.py b/tests/unit/auth/fixtures/user_fixtures.py
index b88d78a..1cf0e20 100644
--- a/tests/unit/auth/fixtures/user_fixtures.py
+++ b/tests/unit/auth/fixtures/user_fixtures.py
@@ -6,8 +6,6 @@ import pytest
from gn_auth.auth.db import sqlite3 as db
from gn_auth.auth.authentication.users import User, hash_password
-from .group_fixtures import TEST_GROUP_01
-
TEST_USERS = (
User(uuid.UUID("ecb52977-3004-469e-9428-2a1856725c7f"), "group@lead.er",
"Group Leader"),
@@ -25,29 +23,6 @@ def fxtr_users(conn_after_auth_migrations, fxtr_group):# pylint: disable=[redefi
with db.cursor(conn_after_auth_migrations) as cursor:
cursor.executemany(query, (
(str(user.user_id), user.email, user.name) for user in TEST_USERS))
- # setup user roles
- cursor.execute("SELECT * FROM group_resources")
- g01res_id = {
- row["group_id"]: row["resource_id"]
- for row in cursor.fetchall()
- }[str(TEST_GROUP_01.group_id)]
- cursor.execute("SELECT * FROM resources WHERE resource_name='GeneNetwork System'")
- sysres_id = cursor.fetchone()["resource_id"]
- test_user_roles = (
- {
- "user_id": "ecb52977-3004-469e-9428-2a1856725c7f",
- "role_id": "a0e67630-d502-4b9f-b23f-6805d0f30e30",# group-leader
- "resource_id": g01res_id
- },
- {
- "user_id": "ecb52977-3004-469e-9428-2a1856725c7f",
- "role_id": "ade7e6b0-ba9c-4b51-87d0-2af7fe39a347",# group-creator
- "resource_id": sysres_id
- })
- cursor.executemany(
- "INSERT INTO user_roles(user_id, role_id, resource_id) "
- "VALUES (:user_id, :role_id, :resource_id)",
- test_user_roles)
yield (conn_after_auth_migrations, TEST_USERS)