From 1f18cf65d0f9f5a9d62048b1a09e24cd179c0060 Mon Sep 17 00:00:00 2001 From: Niko Lindroos Date: Thu, 19 Dec 2024 12:31:42 +0200 Subject: [PATCH] test(auditlog): improve unit test performance KK-1113 --- children/tests/test_api.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/children/tests/test_api.py b/children/tests/test_api.py index ed5314a3..6afee94b 100644 --- a/children/tests/test_api.py +++ b/children/tests/test_api.py @@ -3,6 +3,7 @@ import pytest import pytz +from auditlog.context import disable_auditlog from dateutil.relativedelta import relativedelta from django.conf import settings from django.utils import timezone @@ -1477,7 +1478,8 @@ def test_children_pagination_result_set( limit = 20 # There should be more than 2 pages. offset = (page - 1) * limit - ChildWithGuardianFactory.create_batch(total_count, project=project) + with disable_auditlog(): + ChildWithGuardianFactory.create_batch(total_count, project=project) variables = {"projectId": get_global_id(project), "limit": limit, "offset": offset} executed = project_user_api_client.execute( @@ -1515,7 +1517,8 @@ def test_children_pagination_cursor_works_the_same_with_offset_and_after( } """ # noqa: E501, - ChildWithGuardianFactory.create_batch(110, project=project) + with disable_auditlog(): + ChildWithGuardianFactory.create_batch(110, project=project) offset = (page - 1) * limit executed_with_offset = project_user_api_client.execute( @@ -1562,7 +1565,8 @@ def test_children_pagination_cursor_generation( total_count = 100 offset = (page - 1) * limit - ChildWithGuardianFactory.create_batch(total_count, project=project) + with disable_auditlog(): + ChildWithGuardianFactory.create_batch(total_count, project=project) query = """ query Children($projectId: ID!, $limit: Int, $offset: Int) {