Skip to content

Commit

Permalink
fix(stats): use freezegun in stats page
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentporte committed Jul 2, 2024
1 parent fd967e6 commit 5a084e5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lacommunaute/stats/tests/tests_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from django.utils.dateformat import format
from django.utils.timezone import localdate
from faker import Faker
from freezegun import freeze_time
from machina.core.loading import get_class
from pytest_django.asserts import assertContains, assertNotContains

Expand Down Expand Up @@ -160,8 +161,9 @@ def test_dsp_count(self, client, db, snapshot):
indirect=["setup_statistiques_data"],
)
def test_visitors_in_context_data(self, client, db, setup_statistiques_data, expected):
url = reverse("stats:statistiques")
response = client.get(url)
with freeze_time("2024-07-01"):
url = reverse("stats:statistiques")
response = client.get(url)
assert response.status_code == 200
assert response.context["stats"] == expected

Expand Down

0 comments on commit 5a084e5

Please sign in to comment.