diff --git a/smash/web/tests/test_view_subjects.py b/smash/web/tests/test_view_subjects.py index 596cd3104f8ec56e5854fb0f15a58f12284e316b..5d822e796d0010fa38871273c366a34b478c86f2 100644 --- a/smash/web/tests/test_view_subjects.py +++ b/smash/web/tests/test_view_subjects.py @@ -1,3 +1,5 @@ +import datetime + from django.contrib.auth.models import User from django.test import Client from django.test import TestCase @@ -7,6 +9,7 @@ from functions import create_subject, create_worker, get_test_location from web.forms import SubjectAddForm from web.models import Subject from web.models.constants import SEX_CHOICES_MALE, SUBJECT_TYPE_CHOICES_CONTROL +from web.views.notifications import get_today_midnight_date class SubjectsViewTests(TestCase): @@ -34,7 +37,7 @@ class SubjectsViewTests(TestCase): self.worker.screening_number_prefix = "X" self.worker.save() - form = SubjectAddForm(user= self.user) + form = SubjectAddForm(user=self.user) form_data = {} for key, value in form.initial.items(): if value is not None: @@ -51,6 +54,23 @@ class SubjectsViewTests(TestCase): self.assertEqual(response.status_code, 302) subject = Subject.objects.all()[0] - self.assertEqual("X-001",subject.screening_number) + self.assertEqual("X-001", subject.screening_number) + + def test_render_subjects(self): + create_subject() + + response = self.client.get(reverse('web.views.subjects')) + self.assertEqual(response.status_code, 200) + def test_render_subjects_with_no_visit(self): + create_subject() + response = self.client.get(reverse('web.views.subject_no_visits')) + self.assertEqual(response.status_code, 200) + + def test_render_subjects_require_contact(self): + subject = create_subject() + subject.datetime_contact_reminder = get_today_midnight_date()+ datetime.timedelta(days=-1) + + response = self.client.get(reverse('web.views.subject_require_contact')) + self.assertEqual(response.status_code, 200)