def test_when_unread(self, mock_send): """The send method should be called when a user has unread notifications.""" NotificationFactory(user=self.user) tasks.daily_digest() mock_send.assert_called_with( self.user, u'Daily Digest', relativedelta(days=1) )
def test_when_no_unread(self, mock_send): """The send method should not be called when a user does not have unread notifications.""" tasks.daily_digest() mock_send.assert_not_called()
def test_when_unread(self, mock_send): """The send method should be called when a user has unread notifications.""" NotificationFactory(user=self.user) tasks.daily_digest() mock_send.assert_called_with(self.user.pk, "Daily Digest", "daily")