Skip to content
Snippets Groups Projects
Commit 8d229eaa authored by Piotr Gawron's avatar Piotr Gawron
Browse files

unit tests for rendering export webpage and exporting appointments without visit defiend

parent c98f0454
No related branches found
No related tags found
1 merge request!100Test coverage unit tests
# coding=utf-8
from django.urls import reverse
from web.models import Appointment
from web.models import Appointment, AppointmentTypeLink
from web.tests import LoggedInTestCase
from web.tests.functions import create_study_subject, create_appointment, create_visit
from web.tests.functions import create_study_subject, create_appointment, create_visit, create_appointment_type
from web.views.export import subject_to_row_for_fields, DROP_OUT_FIELD
......@@ -13,6 +13,11 @@ class TestExportView(LoggedInTestCase):
response = self.client.get(reverse('web.views.export_to_csv', kwargs={'data_type': "subjects"}))
self.assertEqual(response.status_code, 200)
def test_render_export(self):
create_study_subject()
response = self.client.get(reverse('web.views.export'))
self.assertEqual(response.status_code, 200)
def test_export_appointments_to_csv(self):
create_appointment()
response = self.client.get(reverse('web.views.export_to_csv', kwargs={'data_type': "appointments"}))
......@@ -24,7 +29,11 @@ class TestExportView(LoggedInTestCase):
self.assertEqual(response.status_code, 200)
def test_export_appointments_to_excel(self):
create_appointment()
appointment = create_appointment()
appointment.visit = None
appointment.save()
AppointmentTypeLink.objects.create(appointment=appointment, appointment_type=create_appointment_type())
response = self.client.get(reverse('web.views.export_to_excel', kwargs={'data_type': "appointments"}))
self.assertEqual(response.status_code, 200)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment