Skip to content

Commit

Permalink
fix(stats): corrections mineures (#661)
Browse files Browse the repository at this point in the history
## 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
  • Loading branch information
vincentporte authored Jun 6, 2024
1 parent 7205a2b commit d3ae4fd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions lacommunaute/forum_stats/tests/tests_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, "<a href=/statistiques/monthly-visitors/>")
self.assertContains(response, f"<a href={reverse('forum_stats:monthly_visitors')}>")


class TestMonthlyVisitorsView:
Expand Down Expand Up @@ -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, '<a href="/statistiques/">retour vers la page statistiques</a>')
assertContains(
response, f"<a href=\"{reverse('forum_stats:statistiques')}\">retour vers la page statistiques</a>"
)
4 changes: 2 additions & 2 deletions lacommunaute/forum_stats/urls.py
Original file line number Diff line number Diff line change
@@ -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"),
]
2 changes: 1 addition & 1 deletion lacommunaute/forum_stats/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit d3ae4fd

Please sign in to comment.