Exemple #1
0
    def setUp(self):
        self.user = build_user()

        log_in_user(self.client, self.user)

        self.pt = core_factories.PatientFactory(case_managers=[self.user])

        self.series_type = factories.VaccineSeriesTypeFactory()

        self.series = factories.VaccineSeriesFactory(
            author=self.user,
            author_type=self.user.groups.first(),
            patient=self.pt,
            kind=self.series_type)
Exemple #2
0
    def setUp(self):
        self.user = build_user()

        log_in_user(self.client, self.user)

        self.pt = core_factories.PatientFactory(case_managers=[self.user])

        self.series_type = factories.VaccineSeriesTypeFactory()

        self.series = factories.VaccineSeriesFactory(
            author=self.user,
            author_type=self.user.groups.first(),
            patient=self.pt,
            kind=self.series_type)

        self.vai = models.VaccineActionItem.objects.create(
            instruction=ActionInstruction.objects.create(
                instruction="Please call"),
            due_date=datetime.date.today(),
            comments="",
            author=self.user,
            author_type=self.user.groups.first(),
            patient=self.pt,
            vaccine=self.series)
Exemple #3
0
    def test_vaccine_series_select_view(self):
        #Create vaccine series for patient
        series1 = factories.VaccineSeriesFactory(
            author=self.user,
            author_type=self.user.groups.first(),
            patient=self.pt,
            kind=self.series_type)

        series2 = models.VaccineSeries.objects.create(
            author=self.user,
            author_type=self.user.groups.first(),
            patient=self.pt,
            kind=factories.VaccineSeriesTypeFactory())

        #Create vaccine series for another patient
        pt2 = Patient.objects.create(
            first_name="Arthur",
            last_name="Miller",
            middle_name="",
            phone='+49 178 236 5288',
            gender=Gender.objects.first(),
            address='Schulstrasse 9',
            city='Munich',
            state='BA',
            zip_code='63108',
            pcp_preferred_zip='63018',
            date_of_birth=datetime.date(1994, 1, 22),
            patient_comfortable_with_english=False,
        )

        series3 = models.VaccineSeries.objects.create(
            author=self.user,
            author_type=self.user.groups.first(),
            patient=pt2,
            kind=factories.VaccineSeriesTypeFactory())

        #Two vaccine series for patient 1
        url = reverse('select-vaccine-series', args=(self.pt.id, ))
        response = self.client.get(url)

        self.assertEqual(response.status_code, 200)
        self.assertContains(response, series1)
        self.assertContains(response, series2)
        self.assertNotContains(response, series3)

        #Contains the button to make new series
        self.assertContains(
            response, '<a href="%s">Create new vaccine series</a>' %
            reverse('new-vaccine-series', args=(self.pt.id, )))

        #One vaccine series for patient 2
        url = reverse('select-vaccine-series', args=(pt2.id, ))
        response = self.client.get(url)

        self.assertEqual(response.status_code, 200)
        self.assertNotContains(response, series1)
        self.assertNotContains(response, series2)
        self.assertContains(response, series3)

        #Submit form and redirect correctly
        response = self.client.post(url, {'series': series3.pk})
        self.assertRedirects(
            response,
            reverse('new-vaccine-dose',
                    kwargs={
                        'pt_id': pt2.id,
                        'series_id': series3.id
                    }))