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 Apr 28, 2024
1 parent d897a79 commit e77c2d5
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 e77c2d5

Please sign in to comment.