Beispiel #1
0
 def test_no_preselect_management_entity_from_training_parent_case_no_parent(self, mock_authorized_types):
     mock_authorized_types.return_value = EducationGroupType.objects.all()
     form = GroupYearModelForm(
         parent=None,
         education_group_type=self.education_group_type,
         user=self.user
     )
     self.assertIsNone(form.fields["management_entity"].initial)
Beispiel #2
0
    def test_create_with_validation_rule(self):
        ValidationRule.objects.create(
            field_reference=(EducationGroupYear._meta.db_table + ".acronym." +
                             self.education_group_type.external_id),
            initial_value="yolo",
            status_field=NOT_REQUIRED,
            regex_rule="([A-Z]{2})(.*)")

        form = GroupYearModelForm(
            education_group_type=self.education_group_type, user=self.user)

        self.assertEqual(form.fields["acronym"].initial, "yolo")
        self.assertEqual(form.fields["acronym"].required, False)
        self.assertEqual(form.fields["acronym"].validators[1].regex,
                         _lazy_re_compile("([A-Z]{2})(.*)"))