From 62d85dff7373a823782ac69ea1281e28b3711b27 Mon Sep 17 00:00:00 2001 From: Piotr Gawron <piotr.gawron@uni.lu> Date: Wed, 29 Mar 2017 10:09:45 +0200 Subject: [PATCH] test for fetting all notifications added --- smash/web/tests/test_view_notifications.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/smash/web/tests/test_view_notifications.py b/smash/web/tests/test_view_notifications.py index 43502784..a65a2e61 100644 --- a/smash/web/tests/test_view_notifications.py +++ b/smash/web/tests/test_view_notifications.py @@ -13,9 +13,11 @@ from web.views.notifications import \ get_approaching_visits_without_appointments, \ get_approaching_visits_without_appointments_count, \ get_exceeded_visit_notifications_count, \ + get_notifications, \ get_subject_with_no_visit_notifications_count, \ get_subjects_with_reminder_count, \ get_visits_without_appointments_count, \ + get_visits_with_missing_appointments_count, \ get_today_midnight_date, \ get_unfinished_appointments, \ get_unfinished_appointments_count, \ @@ -62,6 +64,25 @@ class NotificationViewTests(TestCase): notification = get_visits_without_appointments_count(self.user) self.assertEquals(original_notification.count + 1, notification.count) + def test_get_visits_with_missing_appointments_count(self): + original_notification = get_visits_with_missing_appointments_count(self.user) + + appointment_type = create_appointment_type() + visit = create_visit() + visit.appointment_types.add(appointment_type) + visit.save() + + notification = get_visits_with_missing_appointments_count(self.user) + self.assertEquals(original_notification.count + 1, notification.count) + + def test_get_notifications(self): + create_worker(self.user) + result = get_notifications(self.user) + + self.assertEquals(0, result[0]) + self.assertTrue(isinstance(result[1], list)) + self.assertTrue(len(result[1]) > 0) + def test_get_visits_without_appointments_count_2(self): appointment_type = create_appointment_type() original_notification = get_visits_without_appointments_count(self.user) -- GitLab