|
12 | 12 | from openedx.core.djangoapps.notifications.grouping_notifications import ( |
13 | 13 | BaseNotificationGrouper, |
14 | 14 | NotificationRegistry, |
15 | | - NewCommentGrouper, |
16 | 15 | group_user_notifications, |
17 | 16 | get_user_existing_notifications, NewPostGrouper |
18 | 17 | ) |
@@ -47,65 +46,6 @@ def test_get_grouper_returns_none_for_unregistered_type(self): |
47 | 46 | self.assertIsNone(grouper) |
48 | 47 |
|
49 | 48 |
|
50 | | -class TestNewCommentGrouper(unittest.TestCase): |
51 | | - """ |
52 | | - Tests for the NewCommentGrouper class |
53 | | - """ |
54 | | - |
55 | | - def setUp(self): |
56 | | - """ |
57 | | - Set up the test |
58 | | - """ |
59 | | - self.new_notification = MagicMock(spec=Notification) |
60 | | - self.old_notification = MagicMock(spec=Notification) |
61 | | - self.old_notification.content_context = { |
62 | | - 'replier_name': 'User1' |
63 | | - } |
64 | | - |
65 | | - def test_group_creates_grouping_keys(self): |
66 | | - """ |
67 | | - Test that the function creates the grouping keys |
68 | | - """ |
69 | | - updated_context = NewCommentGrouper().group(self.new_notification, self.old_notification) |
70 | | - |
71 | | - self.assertIn('replier_name_list', updated_context) |
72 | | - self.assertIn('grouped_count', updated_context) |
73 | | - self.assertEqual(updated_context['grouped_count'], 2) |
74 | | - self.assertTrue(updated_context['grouped']) |
75 | | - |
76 | | - def test_group_appends_to_existing_grouping(self): |
77 | | - """ |
78 | | - Test that the function appends to the existing grouping |
79 | | - """ |
80 | | - # Mock a pre-grouped notification |
81 | | - self.old_notification.content_context = { |
82 | | - 'replier_name': 'User1', |
83 | | - 'replier_name_list': ['User1', 'User2'], |
84 | | - 'grouped': True, |
85 | | - 'grouped_count': 2 |
86 | | - } |
87 | | - self.new_notification.content_context = {'replier_name': 'User3'} |
88 | | - |
89 | | - updated_context = NewCommentGrouper().group(self.new_notification, self.old_notification) |
90 | | - |
91 | | - self.assertIn('replier_name_list', updated_context) |
92 | | - self.assertEqual(len(updated_context['replier_name_list']), 3) |
93 | | - self.assertEqual(updated_context['grouped_count'], 3) |
94 | | - |
95 | | - def test_group_email_content(self): |
96 | | - """ |
97 | | - Tests email_content in content_context when grouping notification |
98 | | - """ |
99 | | - self.old_notification.content_context['email_content'] = 'old content' |
100 | | - self.new_notification.content_context = { |
101 | | - 'email_content': 'new content', |
102 | | - 'replier_name': 'user_2', |
103 | | - } |
104 | | - content_context = NewCommentGrouper().group(self.new_notification, self.old_notification) |
105 | | - self.assertIn('email_content', content_context) |
106 | | - self.assertEqual(content_context['email_content'], 'new content') |
107 | | - |
108 | | - |
109 | 49 | class TestNewPostGrouper(unittest.TestCase): |
110 | 50 | """ |
111 | 51 | Tests for the NewPostGrouper class |
@@ -159,7 +99,7 @@ def test_group_user_notifications(self, mock_get_grouper): |
159 | 99 | Test that the function groups notifications using the appropriate grou |
160 | 100 | """ |
161 | 101 | # Mock the grouper |
162 | | - mock_grouper = MagicMock(spec=NewCommentGrouper) |
| 102 | + mock_grouper = MagicMock(spec=NewPostGrouper) |
163 | 103 | mock_get_grouper.return_value = mock_grouper |
164 | 104 |
|
165 | 105 | new_notification = MagicMock(spec=Notification) |
@@ -237,7 +177,7 @@ def test_get_user_existing_notifications(self, mock_filter): |
237 | 177 | mock_filter.return_value = [mock_notification1, mock_notification2] |
238 | 178 |
|
239 | 179 | user_ids = [1, 2] |
240 | | - notification_type = 'new_comment' |
| 180 | + notification_type = 'new_discussion_post' |
241 | 181 | group_by_id = 'group_id_1' |
242 | 182 | course_id = 'course_1' |
243 | 183 |
|
|
0 commit comments