Skip to content

Commit

Permalink
Fix last-login filter test to account for timezones
Browse files Browse the repository at this point in the history
  • Loading branch information
gasman committed Apr 10, 2024
1 parent 08e4bd4 commit 8149639
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion wagtail/users/tests/test_admin_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,11 @@ def test_filters(self):
self.assertEqual(response.status_code, 200)
self.assertCountEqual(response.context["object_list"], [self.test_user])

today = timezone.now().date()
now = timezone.now()
if timezone.is_aware(now):
today = timezone.localtime(now).date()
else:
today = now.date()
tomorrow = today + timezone.timedelta(days=1)
yesterday = today - timezone.timedelta(days=1)

Expand Down

0 comments on commit 8149639

Please sign in to comment.