Skip to content

Commit

Permalink
fix tests with forms missing site
Browse files Browse the repository at this point in the history
  • Loading branch information
erikvw committed Jan 22, 2024
1 parent 89f1e78 commit 5806deb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions edc_offstudy/tests/tests/test_offstudy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from dateutil.relativedelta import relativedelta
from django.conf import settings
from django.contrib.sites.models import Site
from django.test import TestCase, override_settings
from edc_action_item import site_action_items
from edc_appointment.constants import INCOMPLETE_APPT
Expand Down Expand Up @@ -258,6 +260,7 @@ def test_modelform_mixin_ok(self):
subject_identifier=self.subject_identifier,
offstudy_datetime=get_utcnow(),
offstudy_reason=DEAD,
site=Site.objects.get(id=settings.SITE_ID).id,
)
# take off schedule1
OffScheduleOne.objects.create(
Expand All @@ -274,6 +277,7 @@ def test_offstudy_modelform(self):
subject_identifier=self.subject_identifier,
offstudy_datetime=get_utcnow(),
offstudy_reason=DEAD,
site=Site.objects.get(id=settings.SITE_ID).id,
)
form = SubjectOffstudyForm(data=data)
self.assertFalse(form.is_valid())
Expand Down Expand Up @@ -307,6 +311,7 @@ def test_crf_modelform_ok(self):
report_datetime=appointments[0].appt_datetime,
visit_schedule_name=appointments[0].visit_schedule_name,
schedule_name=appointments[0].schedule_name,
site=Site.objects.get(id=settings.SITE_ID).id,
)
form = CrfOneForm(data=data)
form.is_valid()
Expand All @@ -332,6 +337,7 @@ def test_crf_modelform_ok(self):
report_datetime=appointments[0].appt_datetime + relativedelta(days=2),
visit_schedule_name="visit_schedule1",
schedule_name="schedule1",
site=Site.objects.get(id=settings.SITE_ID).id,
)
form = CrfOneForm(data=data)
self.assertFalse(form.is_valid())
Expand All @@ -342,6 +348,7 @@ def test_non_crf_modelform1(self):
data = dict(
subject_identifier=self.subject_identifier,
report_datetime=self.consent_datetime,
site=Site.objects.get(id=settings.SITE_ID).id,
)
form = NonCrfOneForm(data=data)
form.is_valid()
Expand All @@ -352,6 +359,7 @@ def test_non_crf_modelform2(self):
data = dict(
subject_identifier=self.subject_identifier,
report_datetime=self.consent_datetime,
site=Site.objects.get(id=settings.SITE_ID).id,
)

# take off schedule1 and hour after trying to submit CRF
Expand Down

0 comments on commit 5806deb

Please sign in to comment.