Passed
Pull Request — master (#259)
by Piotr
03:28
created

test_failed_confirmation_email_user_without_email()   A

Complexity

Conditions 2

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 2
c 2
b 0
f 0
dl 0
loc 5
rs 9.4285
1
import pytest
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...
introduced by
Unable to import 'pytest'
Loading history...
2
3
from djoser import pipelines
4
5
6
def test_valid_activation_email_without_request(test_user, mailoutbox):
0 ignored issues
show
Coding Style Naming introduced by
The name test_valid_activation_email_without_request does not conform to the function 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 function 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...
7
    context = {'request': None, 'user': test_user}
8
    assert test_user.is_active is True
9
10
    pipelines.email.activation_email(**context)
11
    test_user.refresh_from_db()
12
13
    assert len(mailoutbox) == 1
14
    assert mailoutbox[0].to == [test_user.email]
15
    assert test_user.is_active is False
16
17
18
def test_failed_activation_email_user_without_email(test_user, mailoutbox):
0 ignored issues
show
Coding Style Naming introduced by
The name test_failed_activation_email_user_without_email does not conform to the function 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 function 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
    test_user.email = ''
20
    context = {'request': None, 'user': test_user}
21
    pipelines.email.activation_email(**context)
22
    assert len(mailoutbox) == 0
0 ignored issues
show
Unused Code introduced by
Do not use len(SEQUENCE) as condition value
Loading history...
23
24
25
def test_failed_activation_email_context_missing_user():
0 ignored issues
show
Coding Style Naming introduced by
The name test_failed_activation_email_context_missing_user does not conform to the function 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 function 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...
26
    context = {'request': None}
27
    with pytest.raises(TypeError):
28
        pipelines.email.activation_email(**context)
29
30
31
def test_failed_activation_email_context_missing_request():
0 ignored issues
show
Coding Style Naming introduced by
The name test_failed_activation_e...context_missing_request does not conform to the function 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 function 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...
32
    context = {'user': None}
33
    with pytest.raises(TypeError):
34
        pipelines.email.activation_email(**context)
35
36
37
def test_valid_confirmation_email_without_request(test_user, mailoutbox):
0 ignored issues
show
Coding Style Naming introduced by
The name test_valid_confirmation_email_without_request does not conform to the function 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 function 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...
38
    context = {'request': None, 'user': test_user}
39
    assert test_user.is_active is True
40
41
    pipelines.email.confirmation_email(**context)
42
    test_user.refresh_from_db()
43
44
    assert len(mailoutbox) == 1
45
    assert mailoutbox[0].to == [test_user.email]
46
    assert test_user.is_active is True
47
48
49
def test_failed_confirmation_email_user_without_email(test_user, mailoutbox):
0 ignored issues
show
Coding Style Naming introduced by
The name test_failed_confirmation_email_user_without_email does not conform to the function 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 function 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...
50
    test_user.email = ''
51
    context = {'request': None, 'user': test_user}
52
    pipelines.email.confirmation_email(**context)
53
    assert len(mailoutbox) == 0
0 ignored issues
show
Unused Code introduced by
Do not use len(SEQUENCE) as condition value
Loading history...
54
55
56
def test_failed_confirmation_email_context_missing_user():
0 ignored issues
show
Coding Style Naming introduced by
The name test_failed_confirmation...il_context_missing_user does not conform to the function 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 function 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...
57
    context = {'request': None}
58
    with pytest.raises(TypeError):
59
        pipelines.email.confirmation_email(**context)
60
61
62
def test_failed_confirmation_email_context_missing_request():
0 ignored issues
show
Coding Style Naming introduced by
The name test_failed_confirmation...context_missing_request does not conform to the function 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 function 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...
63
    context = {'user': None}
64
    with pytest.raises(TypeError):
65
        pipelines.email.confirmation_email(**context)
66