test_notification.py 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # -*- coding: utf-8 -*-
  2. import os
  3. import re
  4. from tracim.lib.core.notifications import DummyNotifier
  5. from tracim.lib.core.notifications import NotifierFactory
  6. from tracim.lib.mail_notifier.notifier import EmailNotifier
  7. from tracim.models.auth import User
  8. from tracim.models.data import Content
  9. from tracim.tests import DefaultTest
  10. from tracim.tests import eq_
  11. class TestDummyNotifier(DefaultTest):
  12. def test_dummy_notifier__notify_content_update(self):
  13. c = Content()
  14. notifier = DummyNotifier(self.app_config, self.session)
  15. notifier.notify_content_update(c)
  16. # INFO - D.A. - 2014-12-09 -
  17. # Old notification_content_update raised an exception
  18. class TestNotifierFactory(DefaultTest):
  19. def test_notifier_factory_method(self):
  20. u = User()
  21. self.app_config.EMAIL_NOTIFICATION_ACTIVATED = True
  22. notifier = NotifierFactory.create(self.app_config, u)
  23. eq_(EmailNotifier, notifier.__class__)
  24. self.app_config.EMAIL_NOTIFICATION_ACTIVATED = False
  25. notifier = NotifierFactory.create(self.app_config, u)
  26. eq_(DummyNotifier, notifier.__class__)
  27. class TestEmailNotifier(DefaultTest):
  28. # TODO - G.M - 04-03-2017 - [emailNotif] - Restore test for email Notif
  29. pass