Skip to content
Snippets Groups Projects
Commit 746edd42 authored by Carlos Vega's avatar Carlos Vega
Browse files

fixed tests for #294

parent 04aa130c
No related branches found
No related tags found
1 merge request!206Improvement/interface changes
......@@ -137,7 +137,7 @@ class AppointmentsViewTests(LoggedInTestCase):
self.assertEqual(Appointment.APPOINTMENT_STATUS_FINISHED, appointment_result.status)
def test_save_appointments_edit_with_invalid_nd_number(self):
subject = create_study_subject(nd_number=None)
subject = create_study_subject(nd_number='DUMB_ND_NUMBER')
visit = create_visit(subject)
appointment = create_appointment(visit, get_today_midnight_date())
......@@ -239,13 +239,42 @@ class AppointmentsViewTests(LoggedInTestCase):
appointment.visit = None
appointment.save()
self.client.post(reverse('web.views.appointment_delete', kwargs={'appointment_id': appointment.id}))
#without permission
self.login_as_staff()
self.client.post(reverse('web.views.appointment_delete', kwargs={'pk': appointment.id}))
self.assertEqual(1, Appointment.objects.all().count())
#with permission
self.login_as_super()
self.client.post(reverse('web.views.appointment_delete', kwargs={'pk': appointment.id}))
self.assertEqual(0, Appointment.objects.all().count())
def test_delete_invalid_appointment_with_visit(self):
def test_delete_appointment_with_visit(self):
self.login_as_super()
appointment = create_appointment()
self.client.post(reverse('web.views.appointment_delete', kwargs={'appointment_id': appointment.id}))
self.client.post(reverse('web.views.appointment_delete', kwargs={'pk': appointment.id}))
self.assertEqual(0, Appointment.objects.all().count())
def test_delete_invalid_finished_appointment(self):
self.login_as_super()
appointment = create_appointment()
appointment.status = Appointment.APPOINTMENT_STATUS_FINISHED
appointment.visit = None
appointment.save()
self.client.post(reverse('web.views.appointment_delete', kwargs={'pk': appointment.id}))
self.assertEqual(1, Appointment.objects.all().count())
def test_delete_invalid_finished_appointment_with_visit(self):
self.login_as_super()
appointment = create_appointment()
appointment.status = Appointment.APPOINTMENT_STATUS_FINISHED
appointment.save()
self.client.post(reverse('web.views.appointment_delete', kwargs={'pk': appointment.id}))
self.assertEqual(1, Appointment.objects.all().count())
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