From 30da2f48eb35360bb339d54da2ab83d96a1cf85b Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 6 Feb 2023 14:20:24 +0300 Subject: auth: resource: Enable viewing the details of a resource. --- tests/unit/auth/test_resources.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'tests/unit/auth/test_resources.py') 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( -- cgit v1.2.3