From d3ae4fd027310d96077809a43957c8a2d7a79eed Mon Sep 17 00:00:00 2001 From: Vincent Porte Date: Thu, 6 Jun 2024 16:17:54 +0200 Subject: [PATCH] fix(stats): corrections mineures (#661) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description 🎸 renommage de la vue `MonthlyVisitorsView` 🎸 utilisation de `reverse` dans les tests pour générer les url dynamiquement 🙄 ## Type de changement 🪲 Correction de bug (changement non cassant qui corrige un problème). 🚧 technique --- lacommunaute/forum_stats/tests/tests_views.py | 6 ++++-- lacommunaute/forum_stats/urls.py | 4 ++-- lacommunaute/forum_stats/views.py | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lacommunaute/forum_stats/tests/tests_views.py b/lacommunaute/forum_stats/tests/tests_views.py index 0a6e0f686..af3316e9b 100644 --- a/lacommunaute/forum_stats/tests/tests_views.py +++ b/lacommunaute/forum_stats/tests/tests_views.py @@ -116,7 +116,7 @@ def test_impact_in_context_data(self): def test_navigation(self): url = reverse("forum_stats:statistiques") response = self.client.get(url) - self.assertContains(response, "") + self.assertContains(response, f"") class TestMonthlyVisitorsView: @@ -162,4 +162,6 @@ def test_navigation(self, client, db): url = reverse("forum_stats:monthly_visitors") response = client.get(url) assert response.status_code == 200 - assertContains(response, 'retour vers la page statistiques') + assertContains( + response, f"retour vers la page statistiques" + ) diff --git a/lacommunaute/forum_stats/urls.py b/lacommunaute/forum_stats/urls.py index afeb23d34..ee5aa09d7 100644 --- a/lacommunaute/forum_stats/urls.py +++ b/lacommunaute/forum_stats/urls.py @@ -1,11 +1,11 @@ from django.urls import path -from lacommunaute.forum_stats.views import MonthlyVisitorsViews, StatistiquesPageView +from lacommunaute.forum_stats.views import MonthlyVisitorsView, StatistiquesPageView app_name = "forum_stats" urlpatterns = [ path("", StatistiquesPageView.as_view(), name="statistiques"), - path("monthly-visitors/", MonthlyVisitorsViews.as_view(), name="monthly_visitors"), + path("monthly-visitors/", MonthlyVisitorsView.as_view(), name="monthly_visitors"), ] diff --git a/lacommunaute/forum_stats/views.py b/lacommunaute/forum_stats/views.py index ecf90fb77..1a3c18de8 100644 --- a/lacommunaute/forum_stats/views.py +++ b/lacommunaute/forum_stats/views.py @@ -75,7 +75,7 @@ def get_context_data(self, **kwargs): return context -class MonthlyVisitorsViews(TemplateView): +class MonthlyVisitorsView(TemplateView): template_name = "forum_stats/monthly_visitors.html" def get_monthly_visitors(self):