aboutsummaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/auth/test_migrations_insert_data_into_empty_table.py4
-rw-r--r--tests/unit/auth/test_resources.py13
2 files changed, 12 insertions, 5 deletions
diff --git a/tests/unit/auth/test_migrations_insert_data_into_empty_table.py b/tests/unit/auth/test_migrations_insert_data_into_empty_table.py
index b4845a0..ebb7fa6 100644
--- a/tests/unit/auth/test_migrations_insert_data_into_empty_table.py
+++ b/tests/unit/auth/test_migrations_insert_data_into_empty_table.py
@@ -10,8 +10,8 @@ from tests.unit.auth.conftest import (
test_params = (
("20221113_01_7M0hv-enumerate-initial-privileges.py", "privileges", 19),
- ("20221114_04_tLUzB-initialise-basic-roles.py", "roles", 1),
- ("20221114_04_tLUzB-initialise-basic-roles.py", "role_privileges", 11))
+ ("20221114_04_tLUzB-initialise-basic-roles.py", "roles", 2),
+ ("20221114_04_tLUzB-initialise-basic-roles.py", "role_privileges", 15))
@pytest.mark.unit_test
@pytest.mark.parametrize(
diff --git a/tests/unit/auth/test_resources.py b/tests/unit/auth/test_resources.py
index 7e3d9ad..840c008 100644
--- a/tests/unit/auth/test_resources.py
+++ b/tests/unit/auth/test_resources.py
@@ -37,13 +37,20 @@ def test_create_resource(mocker, fxtr_users_in_group, user, expected):
mocker.patch("gn3.auth.authorisation.checks.require_oauth.acquire",
conftest.get_tokeniser(user))
conn, _group, _users = fxtr_users_in_group
- assert create_resource(
- conn, "test_resource", resource_category, user) == expected
+ resource = create_resource(conn, "test_resource", resource_category, user)
+ assert resource == expected
with db.cursor(conn) as cursor:
# Cleanup
cursor.execute(
- "DELETE FROM resources WHERE resource_id=?", (str(uuid_fn()),))
+ "DELETE FROM group_user_roles_on_resources WHERE resource_id=?",
+ (str(resource.resource_id),))
+ cursor.execute(
+ "DELETE FROM group_roles WHERE group_id=?",
+ (str(resource.group.group_id),))
+ cursor.execute(
+ "DELETE FROM resources WHERE resource_id=?",
+ (str(resource.resource_id),))
@pytest.mark.unit_test
@pytest.mark.parametrize(