From f640f3f97e7ee646886b29470f2f4cb32af323c7 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 15 Nov 2022 03:49:28 +0300 Subject: tests: Fix cause of `DeprecationWarning` * tests/unit/auth/test_groups.py: use Flask's application context directly rather than the request context to access `g` in order to get rid of the `DeprecationWarning`. --- tests/unit/auth/test_groups.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/unit/auth/test_groups.py b/tests/unit/auth/test_groups.py index 18abbc6..ac575d0 100644 --- a/tests/unit/auth/test_groups.py +++ b/tests/unit/auth/test_groups.py @@ -28,7 +28,7 @@ group_leader_id = lambda : UUID("d32611e3-07fc-4564-b56c-786c6db6de2b") ("e614247d-84d2-491d-a048-f80b578216cb", create_group_failure))) def test_create_group(test_app, auth_testdb_path, mocker, test_users, user_id, expected): mocker.patch("gn3.auth.authorisation.groups.uuid.uuid4", group_leader_id) - with test_app.test_request_context() as flask_context: + with test_app.app_context() as flask_context: flask_context.g.user_id = UUID(user_id) with db.connection(auth_testdb_path) as conn: assert create_group(conn, "a_test_group") == expected -- cgit v1.2.3