Ejemplo n.º 1
0
    def setUp(self):
        super(StudyViewSetTest, self).setUp()

        self.coordinator = CoordinatorFactory.create(doctor_ptr=self.doctor)
        self.other_doctor = DoctorFactory(password='******')
        self.patient = PatientFactory.create()
        self.consent_doc = ConsentDocFactory.create()
Ejemplo n.º 2
0
 def test_get_by_email_for_exists_patient(self):
     self.authenticate_as_doctor()
     study = StudyFactory.create()
     patient = PatientFactory.create(doctor=self.doctor)
     StudyInvitationFactory.create(email='*****@*****.**',
                                   doctor=self.doctor,
                                   study=study,
                                   patient=patient)
     resp = self.client.get(
         '/api/v1/doctor/get_by_email/[email protected]')
     self.assertBadRequest(resp)
Ejemplo n.º 3
0
    def test_validate_study_consent(self):
        study = StudyFactory.create()
        patient = PatientFactory.create()
        expired = timezone.now() - timedelta(days=1)
        consent = PatientConsentFactory.create(patient=patient,
                                               date_expired=expired)

        StudyToPatient.objects.create(study=study,
                                      patient=patient,
                                      patient_consent=consent)

        validate_study_consent_for_patient(study, patient)
Ejemplo n.º 4
0
    def setUp(self):
        super(MolesTestCase, self).setUp()

        self.first_patient = PatientFactory.create(doctor=self.doctor)
        self.first_patient_consent = PatientConsentFactory(
            patient=self.first_patient)
        self.another_patient = PatientFactory()

        self.anatomical_site = AnatomicalSiteFactory.create()

        self.first_patient_asite = PatientAnatomicalSiteFactory.create(
            patient=self.first_patient,
            anatomical_site=self.anatomical_site)
        self.another_patient_asite = PatientAnatomicalSiteFactory.create(
            patient=self.another_patient,
            anatomical_site=self.anatomical_site)

        self.first_patient_mole = MoleFactory.create(
            patient=self.first_patient,
            anatomical_site=self.anatomical_site)

        self.another_patient_mole = MoleFactory.create(
            patient=self.another_patient,
            anatomical_site=self.anatomical_site)
Ejemplo n.º 5
0
    def test_validate_study_consent_with_error(self):
        study = StudyFactory.create()
        patient = PatientFactory.create()
        expired = timezone.now() - timedelta(days=1)
        consent = PatientConsentFactory.create(patient=patient,
                                               date_expired=expired)
        consent.date_expired = expired
        consent.save()

        StudyToPatient.objects.create(study=study,
                                      patient=patient,
                                      patient_consent=consent)

        with self.assertRaises(serializers.ValidationError):
            validate_study_consent_for_patient(study, patient)
Ejemplo n.º 6
0
 def test_register_as_doctor_with_patient_email(self):
     study = StudyFactory.create()
     patient = PatientFactory.create(doctor=self.doctor)
     StudyInvitationFactory.create(email='*****@*****.**',
                                   doctor=self.doctor,
                                   study=study,
                                   patient=patient)
     data = {
         'first_name': Faker('first_name').generate({}),
         'last_name': Faker('last_name').generate({}),
         'email': '*****@*****.**',
         'password': Faker('password').generate({}),
         'site': self.site.id,
     }
     resp = self.client.post('/api/v1/auth/register/', data)
     self.assertBadRequest(resp)
Ejemplo n.º 7
0
    def setUp(self):
        self.doctor = DoctorFactory.create()
        self.patient = PatientFactory.create()
        self.study = StudyFactory.create(
            author=CoordinatorFactory.create()
        )
        self.study.doctors.add(self.doctor)
        self.study.save()

        DoctorToPatient.objects.create(
            doctor=self.doctor,
            patient=self.patient)
        consent = PatientConsentFactory.create(
            patient=self.patient)
        self.study_to_patient = StudyToPatient.objects.create(
            study=self.study,
            patient=self.patient,
            patient_consent=consent)