diff --git a/smash/web/tests/forms/test_StudySubjectEditForm.py b/smash/web/tests/forms/test_StudySubjectEditForm.py index 57395339e3a78c6d21c48968fbd08cfc3b930e60..1e7a5c0919c5b3ed775b23e1cf4bb1b3ab538f59 100644 --- a/smash/web/tests/forms/test_StudySubjectEditForm.py +++ b/smash/web/tests/forms/test_StudySubjectEditForm.py @@ -3,7 +3,7 @@ import logging from web.forms import StudySubjectEditForm from web.models import StudySubject from web.tests import LoggedInWithWorkerTestCase -from web.tests.functions import create_study_subject +from web.tests.functions import create_study_subject, create_empty_study logger = logging.getLogger(__name__) @@ -31,6 +31,14 @@ class StudySubjectEditFormTests(LoggedInWithWorkerTestCase): save_status = edit_form.is_valid() self.assertTrue(save_status) + def test_validation_with_empty_study(self): + self.study_subject.study = create_empty_study() + self.study_subject.save() + + edit_form = StudySubjectEditForm(self.sample_data) + save_status = edit_form.is_valid() + self.assertTrue(save_status) + def test_invalid_nd_number_edit(self): study_subject2 = create_study_subject(124) study_subject2.nd_number = "ND0124"