Skip to content

Commit

Permalink
fix: flaky test because of unique username issue, reseed to address
Browse files Browse the repository at this point in the history
  • Loading branch information
sirtawast committed Mar 21, 2024
1 parent 63c95f1 commit f6c786c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions backend/benefit/applications/tests/test_ahjo_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
from applications.tests.factories import ApplicationFactory, DecidedApplicationFactory
from calculator.models import Calculation
from calculator.tests.factories import PaySubsidyFactory
from common.tests.conftest import reseed
from common.utils import hash_file
from companies.tests.factories import CompanyFactory
from helsinkibenefit.tests.conftest import * # noqa
Expand Down Expand Up @@ -216,16 +217,22 @@ def test_generate_composed_template_html(mock_pdf_convert):
)


# Test flaking if no reseed is used
def test_export_application_batch(application_batch):
reseed(12345)
application_batch.applications.add(
DecidedApplicationFactory.create(
status=ApplicationStatus.ACCEPTED,
calculation__calculated_benefit_amount=1000,
)
)

reseed(23456)
application_batch.applications.add(
DecidedApplicationFactory.create(status=ApplicationStatus.REJECTED)
)

reseed(34567)
application_batch.applications.add(
DecidedApplicationFactory.create(status=ApplicationStatus.CANCELLED)
)
Expand All @@ -239,6 +246,7 @@ def test_export_application_batch(application_batch):
).count()
+ 4
)
reseed(777)


@patch("applications.services.ahjo_integration.pdfkit.from_string")
Expand Down

0 comments on commit f6c786c

Please sign in to comment.