diff --git a/openedx/core/djangoapps/notifications/tests/test_views.py b/openedx/core/djangoapps/notifications/tests/test_views.py index 3a977ea6ce27..ec3dbe4dcb9b 100644 --- a/openedx/core/djangoapps/notifications/tests/test_views.py +++ b/openedx/core/djangoapps/notifications/tests/test_views.py @@ -496,7 +496,8 @@ def test_get_unseen_notifications_count_with_show_notifications_tray(self, show_ self.assertEqual(response.status_code, 200) self.assertEqual(response.data['count'], 4) - self.assertEqual(response.data['count_by_app_name'], {'App Name 1': 2, 'App Name 2': 1, 'App Name 3': 1}) + self.assertEqual(response.data['count_by_app_name'], { + 'App Name 1': 2, 'App Name 2': 1, 'App Name 3': 1, 'discussion': 0}) self.assertEqual(response.data['show_notifications_tray'], show_notifications_tray_enabled) def test_get_unseen_notifications_count_for_unauthenticated_user(self): @@ -517,7 +518,7 @@ def test_get_unseen_notifications_count_for_user_with_no_notifications(self): self.assertEqual(response.status_code, 200) self.assertEqual(response.data['count'], 0) - self.assertEqual(response.data['count_by_app_name'], {}) + self.assertEqual(response.data['count_by_app_name'], {'discussion': 0}) class MarkNotificationsSeenAPIViewTestCase(APITestCase): diff --git a/openedx/core/djangoapps/notifications/views.py b/openedx/core/djangoapps/notifications/views.py index 2ea38d5e8a27..83838bd6c422 100644 --- a/openedx/core/djangoapps/notifications/views.py +++ b/openedx/core/djangoapps/notifications/views.py @@ -289,8 +289,11 @@ def get(self, request): .annotate(count=Count('*')) ) count_total = 0 - count_by_app_name_dict = {} show_notifications_tray_enabled = False + count_by_app_name_dict = { + app_name: 0 + for app_name in COURSE_NOTIFICATION_APPS + } for item in count_by_app_name: app_name = item['app_name']