From 911a76af662dc188aec79dbcf3dc79e12730a6ee Mon Sep 17 00:00:00 2001 From: Arnaud-D <35631001+Arnaud-D@users.noreply.github.com> Date: Sat, 9 Dec 2023 19:18:04 +0100 Subject: [PATCH] =?UTF-8?q?Refactorise=20un=20test=20pour=20=C3=AAtre=20pl?= =?UTF-8?q?us=20robuste?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tests/tests_views/tests_addcontributor.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/zds/tutorialv2/tests/tests_views/tests_addcontributor.py b/zds/tutorialv2/tests/tests_views/tests_addcontributor.py index bfff5615b9..9577fbc0d8 100644 --- a/zds/tutorialv2/tests/tests_views/tests_addcontributor.py +++ b/zds/tutorialv2/tests/tests_views/tests_addcontributor.py @@ -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 @@ -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):