Beispiel #1
0
    def test_active_patient(self, mockServer):
        """Test correct path - everything is ok"""

        mockServer.return_value.add_participants.return_value = [{
            'emailstatus':
            'OK',
            'sent':
            'N',
            'usesleft':
            1,
            'lastname':
            '',
            'blacklisted':
            None,
            'token':
            'hXDBhg9JWC1TlTV',
            'email':
            '',
            'language':
            None,
            'remindercount':
            0,
            'validuntil':
            None,
            'firstname':
            '',
            'validfrom':
            None,
            'completed':
            'N',
            'remindersent':
            'N',
            'tid':
            '4501',
            'participant_id':
            None,
            'mpid':
            None
        }]

        patient_mock = self.util.create_patient_mock(user=self.user)
        survey_mock = self.util.create_survey_mock(QUESTIONNAIRE_ID, True)
        self.util.create_response_survey_mock(self.user, patient_mock,
                                              survey_mock)

        subject_id = str(float(patient_mock.pk))

        response = is_patient_active(subject_id)
        self.assertTrue(response)

        subject_id = str(patient_mock.pk)
        response = is_patient_active(subject_id)
        self.assertTrue(response)
Beispiel #2
0
    def test_subject_is_not_number(self):
        """ Test when subject value is incorrect """

        subject_id = "subject_error"

        response = is_patient_active(subject_id)
        self.assertTrue(not response)
Beispiel #3
0
    def test_active_patient(self):
        """ Test correct path - everything is ok """

        patient_mock = self.util.create_patient_mock(user=self.user)
        survey_mock = self.util.create_survey_mock(QUESTIONNAIRE_ID, True)
        self.util.create_response_survey_mock(self.user, patient_mock,
                                              survey_mock)

        subject_id = str(float(patient_mock.pk))

        response = is_patient_active(subject_id)
        self.assertTrue(response)

        subject_id = str(patient_mock.pk)
        response = is_patient_active(subject_id)
        self.assertTrue(response)
Beispiel #4
0
    def test_subject_is_not_number(self):
        """ Test when subject value is incorrect """

        subject_id = "subject_error"

        response = is_patient_active(subject_id)
        self.assertTrue(not response)
Beispiel #5
0
    def test_active_patient(self):
        """ Test correct path - everything is ok """

        patient_mock = self.util.create_patient_mock(user=self.user)
        survey_mock = self.util.create_survey_mock(QUESTIONNAIRE_ID, True)
        self.util.create_response_survey_mock(
            self.user, patient_mock, survey_mock
        )

        subject_id = str(float(patient_mock.pk))

        response = is_patient_active(subject_id)
        self.assertTrue(response)

        subject_id = str(patient_mock.pk)
        response = is_patient_active(subject_id)
        self.assertTrue(response)
Beispiel #6
0
    def test_patient_not_in_questionnaire_response(self):
        """ Test when subject is not in questionnaire response """

        patient_mock = self.util.create_patient_mock(user=self.user)
        self.util.create_survey_mock(QUESTIONNAIRE_ID, True)

        subject_id = str(float(patient_mock.pk))
        response = is_patient_active(subject_id)
        self.assertTrue(not response)
Beispiel #7
0
    def test_patient_not_in_questionnaire_response(self):
        """ Test when subject is not in questionnaire response """

        patient_mock = self.util.create_patient_mock(user=self.user)
        self.util.create_survey_mock(QUESTIONNAIRE_ID, True)

        subject_id = str(float(patient_mock.pk))
        response = is_patient_active(subject_id)
        self.assertTrue(not response)
Beispiel #8
0
    def test_patient_removed_from_database(self):
        """ Test when patient is removed """

        patient_mock = self.util.create_patient_mock(user=self.user)
        patient_mock.removed = True
        patient_mock.save()

        survey_mock = self.util.create_survey_mock(QUESTIONNAIRE_ID, True)
        self.util.create_response_survey_mock(self.user, patient_mock, survey_mock)

        subject_id = str(float(patient_mock.pk))
        response = is_patient_active(subject_id)
        self.assertTrue(not response)
Beispiel #9
0
    def test_patient_removed_from_database(self):
        """ Test when patient is removed """

        patient_mock = self.util.create_patient_mock(user=self.user)
        patient_mock.removed = True
        patient_mock.save()

        survey_mock = self.util.create_survey_mock(QUESTIONNAIRE_ID, True)
        self.util.create_response_survey_mock(self.user, patient_mock, survey_mock)

        subject_id = str(float(patient_mock.pk))
        response = is_patient_active(subject_id)
        self.assertTrue(not response)