| Total Complexity | 2 |
| Total Lines | 40 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | # -*- coding: utf-8 -*- |
||
|
|
|||
| 2 | import os |
||
| 3 | import re |
||
| 4 | |||
| 5 | |||
| 6 | from tracim.lib.core.notifications import DummyNotifier |
||
| 7 | from tracim.lib.core.notifications import EmailNotifier |
||
| 8 | from tracim.lib.core.notifications import NotifierFactory |
||
| 9 | from tracim.models.auth import User |
||
| 10 | from tracim.models.data import Content |
||
| 11 | from tracim.tests import DefaultTest |
||
| 12 | from tracim.tests import eq_ |
||
| 13 | |||
| 14 | class TestDummyNotifier(DefaultTest): |
||
| 15 | |||
| 16 | def test_dummy_notifier__notify_content_update(self): |
||
| 17 | c = Content() |
||
| 18 | notifier = DummyNotifier(self.app_config) |
||
| 19 | notifier.notify_content_update(c) |
||
| 20 | # INFO - D.A. - 2014-12-09 - |
||
| 21 | # Old notification_content_update raised an exception |
||
| 22 | |||
| 23 | |||
| 24 | class TestNotifierFactory(DefaultTest): |
||
| 25 | def test_notifier_factory_method(self): |
||
| 26 | u = User() |
||
| 27 | |||
| 28 | self.app_config.EMAIL_NOTIFICATION_ACTIVATED = True |
||
| 29 | notifier = NotifierFactory.create(self.app_config, u) |
||
| 30 | eq_(EmailNotifier, notifier.__class__) |
||
| 31 | |||
| 32 | self.app_config.EMAIL_NOTIFICATION_ACTIVATED = False |
||
| 33 | notifier = NotifierFactory.create(self.app_config, u) |
||
| 34 | eq_(DummyNotifier, notifier.__class__) |
||
| 35 | |||
| 36 | |||
| 37 | class TestEmailNotifier(DefaultTest): |
||
| 38 | # TODO - G.M - 04-03-2017 - [emailNotif] - Restore test for email Notif |
||
| 39 | pass |
||
| 40 |
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.