Completed
Pull Request — master (#259)
by Piotr
02:26
created

test_valid_activation_email_without_request()   B

Complexity

Conditions 5

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 5
c 1
b 0
f 0
dl 0
loc 10
rs 8.5454
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 = {'user': test_user}
8
    assert test_user.is_active is True
9
10
    pipelines.email.activation_email(request=None, context=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 = {'user': test_user}
21
    pipelines.email.activation_email(request=None, context=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_user_empty_context():
0 ignored issues
show
Coding Style Naming introduced by
The name test_failed_activation_email_user_empty_context 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 = {}
27
    with pytest.raises(AssertionError):
28
        pipelines.email.activation_email(request=None, context=context)
29
30
31
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...
32
    context = {'user': test_user}
33
    assert test_user.is_active is True
34
35
    pipelines.email.confirmation_email(request=None, context=context)
36
    test_user.refresh_from_db()
37
38
    assert len(mailoutbox) == 1
39
    assert mailoutbox[0].to == [test_user.email]
40
    assert test_user.is_active is True
41
42
43
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...
44
    test_user.email = ''
45
    context = {'user': test_user}
46
    pipelines.email.confirmation_email(request=None, context=context)
47
    assert len(mailoutbox) == 0
0 ignored issues
show
Unused Code introduced by
Do not use len(SEQUENCE) as condition value
Loading history...
48
49
50
def test_failed_confirmation_email_user_empty_context():
0 ignored issues
show
Coding Style Naming introduced by
The name test_failed_confirmation_email_user_empty_context 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...
51
    context = {}
52
    with pytest.raises(AssertionError):
53
        pipelines.email.confirmation_email(request=None, context=context)
54
55
56
def test_valid_password_reset_email_without_request(test_user, mailoutbox):
0 ignored issues
show
Coding Style Naming introduced by
The name test_valid_password_reset_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...
57
    context = {'user': test_user}
58
    assert test_user.is_active is True
59
60
    pipelines.email.password_reset_email(request=None, context=context)
61
    test_user.refresh_from_db()
62
63
    assert len(mailoutbox) == 1
64
    assert mailoutbox[0].to == [test_user.email]
65
    assert test_user.is_active is True
66
67
68
def test_failed_password_reset_email_user_without_email(test_user, mailoutbox):
0 ignored issues
show
Coding Style Naming introduced by
The name test_failed_password_res...mail_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...
69
    test_user.email = ''
70
    context = {'user': test_user}
71
    pipelines.email.password_reset_email(request=None, context=context)
72
    assert len(mailoutbox) == 0
0 ignored issues
show
Unused Code introduced by
Do not use len(SEQUENCE) as condition value
Loading history...
73
74
75
def test_failed_password_reset_email_user_empty_context():
0 ignored issues
show
Coding Style Naming introduced by
The name test_failed_password_res...mail_user_empty_context 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...
76
    context = {}
77
    with pytest.raises(AssertionError):
78
        pipelines.email.password_reset_email(request=None, context=context)
79