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

tests for get_filter_locations

parent 5afc98ea
No related branches found
No related tags found
1 merge request!34Performance of subject list
Pipeline #
import datetime
from django.contrib.auth.models import User
from django.contrib.auth.models import AnonymousUser, User
from django.test import TestCase, RequestFactory
from functions import create_appointment, create_location, create_worker, create_appointment_type
......@@ -13,6 +13,7 @@ from web.views.notifications import \
get_approaching_visits_without_appointments, \
get_approaching_visits_without_appointments_count, \
get_exceeded_visit_notifications_count, \
get_filter_locations, \
get_notifications, \
get_subject_with_no_visit_notifications_count, \
get_subjects_with_reminder_count, \
......@@ -21,7 +22,7 @@ from web.views.notifications import \
get_today_midnight_date, \
get_unfinished_appointments, \
get_unfinished_appointments_count, \
get_unfinished_visits, get_active_visits_with_missing_appointments
get_unfinished_visits
class NotificationViewTests(TestCase):
......@@ -85,7 +86,7 @@ class NotificationViewTests(TestCase):
appointment = create_appointment(visit)
appointment.appointment_types.add(appointment_type)
appointment.status=Appointment.APPOINTMENT_STATUS_FINISHED
appointment.status = Appointment.APPOINTMENT_STATUS_FINISHED
appointment.save()
notification = get_visits_with_missing_appointments_count(self.user)
......@@ -426,3 +427,14 @@ class NotificationViewTests(TestCase):
notification = get_subject_with_no_visit_notifications_count(self.user)
self.assertEquals(original_without_visit_notification.count, notification.count)
def test_get_filter_locations_for_invalid_user(self):
locations = get_filter_locations(AnonymousUser())
self.assertEqual(0, locations.count())
def test_get_filter_locations_for_invalid_user_2(self):
try:
locations = get_filter_locations("invalid class")
self.fail("Exception expected")
except TypeError:
pass
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