Beispiel #1
0
 def test_post_with_errors(self):
     expected_educ_group_year, wrong_post_data = _get_valid_post_data(
         self.category)
     wrong_post_data['management_entity'] = None
     wrong_post_data['end_year'] = "some text"
     education_group_year_form = MiniTrainingModelForm(wrong_post_data)
     education_group_form = EducationGroupModelForm(wrong_post_data)
     form = CommonBaseForm(education_group_year_form, education_group_form)
     self.assertFalse(form.is_valid(), form.errors)
     self.assertEqual(len(form.errors), 2)
Beispiel #2
0
 def _test_when_mini_training_form_is_not_valid(self, mock_is_valid):
     self.assertFalse(
         CommonBaseForm(
             self.post_data,
             user=UserFactory(),
             education_group_type=self.egt
         ).is_valid()
     )
Beispiel #3
0
 def test_when_both_of_two_forms_are_valid(self, mock_is_valid,
                                           mock_mintraining_is_valid):
     self.assertTrue(
         CommonBaseForm(self.education_group_year_form,
                        self.education_group_form).is_valid())
Beispiel #4
0
 def test_when_education_group_model_form_is_not_valid(self, mock_is_valid):
     self.assertFalse(
         CommonBaseForm(self.education_group_year_form,
                        self.education_group_form).is_valid())
Beispiel #5
0
 def _test_when_mini_training_form_is_not_valid(self, mock_is_valid):
     self.assertFalse(
         CommonBaseForm(self.education_group_year_form,
                        self.education_group_form).is_valid())