Skip to content
Snippets Groups Projects

Resolve "PDP study patient data"

Merged Piotr Gawron requested to merge 186-pdp-study-patient-data into master
1 file
+ 43
2
Compare changes
  • Side-by-side
  • Inline
@@ -5,12 +5,12 @@ import logging
from django.urls import reverse
from web.tests import LoggedInWithWorkerTestCase
from web.api_views.subject import get_subjects_order, get_subjects_filtered, serialize_subject
from web.models import StudySubject, Appointment, Study
from web.models import StudySubject, Appointment, Study, Worker
from web.models.constants import GLOBAL_STUDY_ID, SUBJECT_TYPE_CHOICES_PATIENT, SUBJECT_TYPE_CHOICES_CONTROL
from web.models.study_subject_list import SUBJECT_LIST_GENERIC, SUBJECT_LIST_NO_VISIT, SUBJECT_LIST_REQUIRE_CONTACT, \
StudySubjectList
from web.tests import LoggedInWithWorkerTestCase
from web.tests.functions import create_study_subject, create_get_suffix, create_visit, \
create_appointment, create_empty_study_columns, create_contact_attempt, create_flying_team
from web.views.notifications import get_today_midnight_date
@@ -534,3 +534,44 @@ class TestSubjectApi(LoggedInWithWorkerTestCase):
create_contact_attempt(subject=subject)
self.check_subject_ordered("last_contact_attempt", [subject, subject2])
def test_subjects_ordered_by_information_sent(self):
subject = self.study_subject
subject.information_sent = False
subject.save()
subject2 = create_study_subject(2)
subject2.information_sent = True
subject2.save()
self.check_subject_ordered("information_sent", [subject, subject2])
def test_subjects_ordered_by_type(self):
subject = self.study_subject
subject.type = SUBJECT_TYPE_CHOICES_CONTROL
subject.save()
subject2 = create_study_subject(2)
subject2.type = SUBJECT_TYPE_CHOICES_PATIENT
subject2.save()
self.check_subject_ordered("type", [subject, subject2])
def test_subjects_ordered_by_social_security_number(self):
subject = self.study_subject
subject.subject.social_security_number = "01"
subject.subject.save()
subject2 = create_study_subject(2)
subject2.subject.social_security_number = "02"
subject2.subject.save()
self.check_subject_ordered("social_security_number", [subject, subject2])
def test_subjects_ordered_by_health_partner(self):
subject = self.study_subject
subject.health_partner = Worker.objects.create(first_name='first1', last_name="name2222", email='jacob@bla', )
subject.save()
subject2 = create_study_subject(2)
subject2.health_partner = Worker.objects.create(first_name='first2', last_name="name1111", email='jacob@bla', )
subject2.save()
self.check_subject_ordered("health_partner_first_name", [subject, subject2])
self.check_subject_ordered("health_partner_last_name", [subject2, subject])
Loading