Skip to content

Commit

Permalink
test(auditlog): improve unit test performance
Browse files Browse the repository at this point in the history
KK-1113
  • Loading branch information
nikomakela committed Dec 19, 2024
1 parent b23b384 commit 1f18cf6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions children/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 1f18cf6

Please sign in to comment.