From 365b00b4df679a3b0aa9cb72374170e41681a20f Mon Sep 17 00:00:00 2001
From: Piotr Gawron <piotr.gawron@uni.lu>
Date: Sat, 2 Dec 2017 20:46:41 +0100
Subject: [PATCH] unit test for checking rendering of form with empty field
 list

---
 smash/web/tests/forms/test_StudySubjectEditForm.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/smash/web/tests/forms/test_StudySubjectEditForm.py b/smash/web/tests/forms/test_StudySubjectEditForm.py
index 57395339..1e7a5c09 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"
-- 
GitLab