Skip to content

Commit

Permalink
Simplify AbstractEligibilityDiagnosisModelFactory.created_at
Browse files Browse the repository at this point in the history
Give the timezone information to faker instead of having it generate a
naive datetime to then localize it.
  • Loading branch information
francoisfreitag committed Jan 9, 2025
1 parent aedf9d6 commit 22cbf2f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/eligibility/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Params:
expired = factory.Trait(
expires_at=factory.LazyFunction(lambda: timezone.localdate() - datetime.timedelta(days=1)),
created_at=factory.LazyAttribute(
lambda obj: timezone.make_aware(faker.date_time(end_datetime=obj.expires_at))
lambda obj: faker.date_time(tzinfo=timezone.get_current_timezone(), end_datetime=obj.expires_at)
),
)

Expand Down

0 comments on commit 22cbf2f

Please sign in to comment.