Skip to content

Commit

Permalink
Corrige l'affichage sur le template
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnaud-D committed Jul 19, 2022
1 parent b9518d4 commit d7cb15c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
14 changes: 8 additions & 6 deletions templates/tutorialv2/includes/editorialization.part.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ <h3>Éditorialisation</h3>
{% crispy form_edit_tags %}
</li>

<li>
<a href="#edit-goals" class="open-modal ico-after gear blue">
{% trans "Modifier les objectifs" %}
</a>
{% crispy form_edit_goals %}
</li>
{% if is_staff %}
<li>
<a href="#edit-goals" class="open-modal ico-after gear blue">
{% trans "Modifier les objectifs" %}
</a>
{% crispy form_edit_goals %}
</li>
{% endif %}

{% if is_staff and not content.is_opinion %}
<li>
Expand Down
17 changes: 16 additions & 1 deletion zds/tutorialv2/tests/tests_views/tests_editgoals.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,26 @@
class EditGoalsPermissionTests(TestCase):
def setUp(self):
self.user = ProfileFactory().user
self.author = ProfileFactory().user
self.staff = StaffProfileFactory().user
self.content = PublishableContentFactory()
self.content.authors.add(self.author)
self.good_url = reverse("content:edit-goals", kwargs={"pk": self.content.pk})
self.bad_url = reverse("content:edit-goals", kwargs={"pk": 42})
self.success_url = reverse("content:view", kwargs={"pk": self.content.pk, "slug": self.content.slug})
self.content_url = reverse("content:view", kwargs={"pk": self.content.pk, "slug": self.content.slug})
self.success_url = self.content_url

def test_display(self):
"""We shall display the form only for staff, not for authors."""
fragment = "Modifier les objectifs"

self.client.force_login(self.author)
response = self.client.get(self.content_url)
self.assertNotContains(response, fragment)

self.client.force_login(self.staff)
response = self.client.get(self.content_url)
self.assertContains(response, fragment)

def test_get_method(self):
"""
Expand Down

0 comments on commit d7cb15c

Please sign in to comment.