Commit 89325b9c by Őry Máté

dashboard: test local_periodic_tasks

parent 97d24537
......@@ -62,7 +62,7 @@ def send_email_notifications():
logger.error("Failed to send mail to %s", user, exc_info=True)
else:"Delivered notifications %s",
" ".join( for j in i))
" ".join(unicode( for j in i))
for j in i:
j.status = j.STATUS.delivered
import unittest
from mock import patch, MagicMock
from ..models import Notification
from ..tasks import local_periodic_tasks
@patch.object(local_periodic_tasks, 'send_mail')
@patch.object(Notification, 'objects')
class EmailNotificationTestCase(unittest.TestCase):
def test_not_sending(self, no, sm):
fake = MagicMock(spec=Notification) = False
no.filter.return_value = [fake]
assert not sm.called
def test_sending(self, no, sm):
fake = MagicMock(spec=Notification) = "user" = "mail" = True = "en"
fake.subject = "subj"
fake.message = "msg"
no.filter.return_value = [fake]
assert sm.called
assert fake.status == fake.STATUS.delivered
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment