Passed
Push — master ( ed1cae...acd77f )
by
unknown
02:26
created

tracim.tests.library.test_notification   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 27
dl 0
loc 42
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A TestDummyNotifier.test_dummy_notifier__notify_content_update() 0 4 1
A TestNotifierFactory.test_notifier_factory_method() 0 10 1
1
# -*- coding: utf-8 -*-
0 ignored issues
show
Coding Style introduced by
This module should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2
import os
0 ignored issues
show
Unused Code introduced by
The import os seems to be unused.
Loading history...
3
import re
0 ignored issues
show
Unused Code introduced by
The import re seems to be unused.
Loading history...
4
5
from nose.tools import eq_
0 ignored issues
show
introduced by
Unable to import 'nose.tools'
Loading history...
6
from nose.tools import ok_
0 ignored issues
show
introduced by
Unable to import 'nose.tools'
Loading history...
Unused Code introduced by
Unused ok_ imported from nose.tools
Loading history...
7
8
from tracim.lib.core.notifications import DummyNotifier
9
from tracim.lib.core.notifications import EmailNotifier
10
from tracim.lib.core.notifications import NotifierFactory
11
from tracim.models.auth import User
12
from tracim.models.data import Content
13
from tracim.tests import DefaultTest
14
15
16
class TestDummyNotifier(DefaultTest):
0 ignored issues
show
Coding Style introduced by
This class should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
Unused Code introduced by
The variable __class__ seems to be unused.
Loading history...
17
18
    def test_dummy_notifier__notify_content_update(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_dummy_notifier__notify_content_update does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
19
        c = Content()
0 ignored issues
show
Coding Style Naming introduced by
The name c does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
20
        notifier = DummyNotifier(self.app_config)
21
        notifier.notify_content_update(c)
22
        # INFO - D.A. - 2014-12-09 -
23
        # Old notification_content_update raised an exception
24
25
26
class TestNotifierFactory(DefaultTest):
0 ignored issues
show
Coding Style introduced by
This class should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
Unused Code introduced by
The variable __class__ seems to be unused.
Loading history...
27
    def test_notifier_factory_method(self):
0 ignored issues
show
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
28
        u = User()
0 ignored issues
show
Coding Style Naming introduced by
The name u does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
29
30
        self.app_config.EMAIL_NOTIFICATION_ACTIVATED = True
31
        notifier = NotifierFactory.create(self.app_config, u)
32
        eq_(EmailNotifier, notifier.__class__)
33
34
        self.app_config.EMAIL_NOTIFICATION_ACTIVATED = False
35
        notifier = NotifierFactory.create(self.app_config, u)
36
        eq_(DummyNotifier, notifier.__class__)
37
38
39
class TestEmailNotifier(DefaultTest):
0 ignored issues
show
Coding Style introduced by
This class should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
40
    # TODO - G.M - 04-03-2017 -  [emailNotif] - Restore test for email Notif
0 ignored issues
show
Coding Style introduced by
TODO and FIXME comments should generally be avoided.
Loading history...
41
    pass
42