diff --git a/tcms/testplans/tests/test_views.py b/tcms/testplans/tests/test_views.py index abeb48bad4..4464c7e3a8 100644 --- a/tcms/testplans/tests/test_views.py +++ b/tcms/testplans/tests/test_views.py @@ -9,6 +9,119 @@ ProductFactory, VersionFactory, PlanTypeFactory) +class NewPlanViewTest(LoggedInTestCase): + @classmethod + def setUpTestData(cls): + super().setUpTestData() + + user_should_have_perm(cls.tester, perm='testplans.add_testplan') + user_should_have_perm(cls.tester, perm='testplans.view_testplan') + + cls.product = ProductFactory() + cls.product_version = VersionFactory(product=cls.product) + cls.test_plan_type = PlanTypeFactory() + cls.test_plan_1 = TestPlanFactory() + + cls.testplan_new_url = reverse('plans-new') + + cls.testplan_new_data = { + 'author': cls.tester.pk, + 'product': cls.product.pk, + 'product_version': cls.product_version.pk, + 'type': cls.test_plan_type.pk, + 'name': cls.test_plan_1.name, + + 'email_settings-0-auto_to_plan_author': 'on', + 'email_settings-0-auto_to_case_owner': 'on', + 'email_settings-0-auto_to_case_default_tester': 'on', + 'email_settings-0-notify_on_case_update': 'on', + 'email_settings-0-notify_on_plan_update': 'on', + + 'email_settings-0-id': cls.test_plan_1.emailing.pk, + 'email_settings-TOTAL_FORMS': '1', + 'email_settings-INITIAL_FORMS': '1', + 'email_settings-MIN_NUM_FORMS': '0', + 'email_settings-MAX_NUM_FORMS': '1', + 'is_active': True, + } + + def test_show_testplan_new_page(self): + response = self.client.get(self.testplan_new_url) + self.assertContains(response, _('Create new TestPlan')) + self.assert_notify_form(response) + self.assertContains( + response, + '