diff --git a/propositions/templates/propositions/liste.html b/propositions/templates/propositions/liste.html index 33a9ec2..4bf8d8f 100644 --- a/propositions/templates/propositions/liste.html +++ b/propositions/templates/propositions/liste.html @@ -5,13 +5,10 @@ {% block content %}
{{ error }}
- {% endif %} - {% if n > 0 %} + {% if propositions.exists %}@@ -21,7 +18,7 @@ | ||
---|---|---|
{% if p.lien %}{% endif %}{{ p.nom }}{% if p.artiste %} - {{ p.artiste }}{% endif %}{% if p.lien %}{% endif %} | diff --git a/propositions/tests.py b/propositions/tests.py index 5bba748..74fd464 100644 --- a/propositions/tests.py +++ b/propositions/tests.py @@ -46,3 +46,19 @@ class PropositionCreateTest(TestCase): self.assertEqual(proposition.user, user.profile) self.assertEqual(proposition.nboui, 0) self.assertEqual(proposition.nbnon, 0) + + +class PropositionListTest(TestCase): + url = reverse_lazy("propositions:list") + + def test_anonymous_get(self): + response = Client().get(self.url) + self.assertRedirects(response, "/login?next={}".format(self.url)) + + def test_get(self): + user = new_user("toto") + client = Client() + client.force_login(user) + + response = client.get(self.url) + self.assertEqual(response.status_code, 200) diff --git a/propositions/urls.py b/propositions/urls.py index a598fdf..e7c260b 100644 --- a/propositions/urls.py +++ b/propositions/urls.py @@ -5,7 +5,7 @@ from propositions import views app_name = "propositions" urlpatterns = [ - path("", views.liste, name="list"), + path("", views.PropositionList.as_view(), name="list"), path("new", views.PropositionCreate.as_view(), name="create"), path("