예제 #1
0
    def test_skip_task_if_more_recent_message_exists(self):
        with suppressed_notifications():
            self.conversation.messages.create(author=self.author,
                                              content='foo')

        tasks.notify_participants(self.message)
        self.assertEqual(len(mail.outbox), 0)
예제 #2
0
def notify_participants(sender, instance, **kwargs):
    message = instance

    if not message.conversation.target:
        return

    tasks.notify_participants(message)
예제 #3
0
    def test_exclude_seen_message(self):
        with suppressed_notifications():
            another_message = self.group.conversation.messages.create(author=self.author, content='foo')
        self.group.conversation.conversationparticipant_set.filter(user=self.user).update(seen_up_to=another_message)

        tasks.notify_participants(another_message)
        self.assertEqual(len(mail.outbox), 0)
예제 #4
0
 def test_only_notifies_active_group_members(self):
     notify_participants(self.message)
     self.assertEqual(len(mail.outbox), 1)
     self.assertEqual(mail.outbox[0].to, [self.user.email])