def test_track_notification_sent(self, context, test_props): with mock.patch('edx_ace.ace.send').start() as message: # Populate mock message ( # There are some cruft attrs, but they're harmless. for key, entry in test_props.items(): setattr(message, key, entry) with mock.patch('analytics.track') as mock_analytics_track: _track_notification_sent(message, context) mock_analytics_track.assert_called_once_with( user_id=context['thread_author_id'], event='edx.bi.email.sent', course_id=context['course_id'], properties=test_props)
def test_track_notification_sent(self, context, test_props): with mock.patch('edx_ace.ace.send').start() as message: # Populate mock message ( # There are some cruft attrs, but they're harmless. for key, entry in test_props.items(): setattr(message, key, entry) with mock.patch('analytics.track') as mock_analytics_track: _track_notification_sent(message, context) mock_analytics_track.assert_called_once_with( user_id=context['thread_author_id'], event='edx.bi.email.sent', course_id=context['course_id'], properties=test_props )
def test_track_notification_sent(self, context, test_props): with mock.patch('edx_ace.ace.send').start() as message: # Populate mock message ( # There are some cruft attrs, but they're harmless. for key, entry in test_props.items(): setattr(message, key, entry) test_props['nonInteraction'] = True # Also augment context with site object, for setting segment context. site = Site.objects.get_current() context['site'] = site with mock.patch('lms.djangoapps.discussion.tasks.segment.track') as mock_segment_track: _track_notification_sent(message, context) mock_segment_track.assert_called_once_with( user_id=context['thread_author_id'], event_name='edx.bi.email.sent', properties=test_props, )
def test_track_notification_sent(self, context, test_props): with mock.patch('edx_ace.ace.send').start() as message: # Populate mock message ( # There are some cruft attrs, but they're harmless. for key, entry in test_props.items(): setattr(message, key, entry) test_props['nonInteraction'] = True # Also augment context with site object, for setting segment context. site = Site.objects.get_current() context['site'] = site with mock.patch('lms.djangoapps.discussion.tasks.segment.track') as mock_segment_track: _track_notification_sent(message, context) mock_segment_track.assert_called_once_with( user_id=context['thread_author_id'], event_name='edx.bi.email.sent', properties=test_props, )