def run_should_not_send_email_test(self, thread, comment_dict): """ assert email is not sent """ self.mock_request.side_effect = make_mock_responder( subscribed_thread_ids=[self.discussion_id], comment_data=comment_dict, thread_data=thread, ) user = mock.Mock() comment = cc.Comment.find(id=comment_dict['id']).retrieve() comment_created.send(sender=None, user=user, post=comment) actual_result = _should_send_message({ 'thread_author_id': self.thread_author.id, 'course_id': self.course.id, 'comment_id': comment_dict['id'], 'thread_id': thread['id'], }) assert actual_result is False assert not self.mock_ace_send.called
def run_should_not_send_email_test(self, comment_dict): self.mock_request.side_effect = make_mock_responder( subscribed_thread_ids=[self.discussion_id], comment_data=comment_dict, thread_data=self.thread, ) user = mock.Mock() comment = cc.Comment.find(id=comment_dict['id']).retrieve() comment_created.send(sender=None, user=user, post=comment) actual_result = _should_send_message({ 'thread_author_id': self.thread_author.id, 'course_id': self.course.id, 'comment_id': comment_dict['id'], 'thread_id': self.thread['id'], }) self.assertEqual(actual_result, False) self.assertFalse(self.mock_ace_send.called)
def run_should_not_send_email_test(self, comment_dict): self.mock_request.side_effect = make_mock_responder( subscribed_thread_ids=[self.discussion_id], comment_data=comment_dict, thread_data=self.thread, ) user = mock.Mock() comment = cc.Comment.find(id=comment_dict['id']).retrieve() with waffle().override(FORUM_RESPONSE_NOTIFICATIONS): comment_created.send(sender=None, user=user, post=comment) actual_result = _should_send_message({ 'thread_author_id': self.thread_author.id, 'course_id': self.course.id, 'comment_id': comment_dict['id'], 'thread_id': self.thread['id'], }) self.assertEqual(actual_result, False) self.assertFalse(self.mock_ace_send.called)
def run_should_send_email_test(self, thread, comment_dict): """ assert email is sent """ self.mock_request.side_effect = make_mock_responder( subscribed_thread_ids=[self.discussion_id], comment_data=comment_dict, thread_data=thread, ) user = mock.Mock() comment = cc.Comment.find(id=comment_dict['id']).retrieve() comment_created.send(sender=None, user=user, post=comment) send_message_status = _should_send_message({ 'thread_author_id': self.thread_author.id, 'course_id': self.course.id, 'comment_id': comment_dict['id'], 'thread_id': thread['id'], }) self.assertEqual(send_message_status, True)