Skip to content

Commit

Permalink
Refactorise un test pour être plus robuste
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnaud-D committed Mar 9, 2024
1 parent 649ea6c commit 911a76a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions zds/tutorialv2/tests/tests_views/tests_addcontributor.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@


from zds.member.tests.factories import ProfileFactory, StaffProfileFactory
from zds.tutorialv2.models import CONTENT_TYPE_LIST
from zds.tutorialv2.tests.factories import ContentContributionRoleFactory, PublishableContentFactory
from zds.tutorialv2.views.contributors import ContributionForm
from zds.tutorialv2.models.database import ContentContribution
Expand Down Expand Up @@ -63,12 +64,12 @@ def test_authenticated_author(self):

def test_authenticated_staff(self):
self.client.force_login(self.staff)
types = ["TUTORIAL", "ARTICLE", "OPINION"]
for type in types:
self.content.type = type
self.content.save()
response = self.client.post(self.form_url, self.form_data)
self.assertRedirects(response, self.content_url)
for type in CONTENT_TYPE_LIST:
with self.subTest(type):
self.content.type = type
self.content.save()
response = self.client.post(self.form_url, self.form_data)
self.assertRedirects(response, self.content_url)


class AddContributorWorkflowTests(TutorialTestMixin, TestCase):
Expand Down

0 comments on commit 911a76a

Please sign in to comment.