Completed
Push — master ( aa58e4...09baaa )
by Piotr
05:40
created

TokenDestroyViewTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
dl 0
loc 36
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A signal_receiver() 0 2 1
A setUp() 0 2 1
A test_post_should_deny_logging_out_when_user_not_logged_in() 0 7 1
A test_post_should_logout_logged_in_user() 0 10 1
A test_options() 0 7 1
1
from django.contrib.auth import user_logged_out
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 'django.contrib.auth'
Loading history...
2
from djet import assertions, restframework
0 ignored issues
show
introduced by
Unable to import 'djet'
Loading history...
3
from rest_framework import status
0 ignored issues
show
introduced by
Unable to import 'rest_framework'
Loading history...
4
import djoser.constants
5
import djoser.utils
6
import djoser.views
7
8
from .common import create_user
9
10
11
class TokenDestroyViewTest(restframework.APIViewTestCase,
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...
12
                           assertions.StatusCodeAssertionsMixin):
13
    view_class = djoser.views.TokenDestroyView
14
15
    def setUp(self):
0 ignored issues
show
Coding Style Naming introduced by
The name setUp 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...
16
        self.signal_sent = False
17
18
    def signal_receiver(self, *args, **kwargs):
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...
Unused Code introduced by
The argument args seems to be unused.
Loading history...
Unused Code introduced by
The argument kwargs seems to be unused.
Loading history...
19
        self.signal_sent = True
20
21
    def test_post_should_logout_logged_in_user(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_post_should_logout_logged_in_user 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...
22
        user = create_user()
23
        user_logged_out.connect(self.signal_receiver)
24
        request = self.factory.post(user=user)
25
26
        response = self.view(request)
27
28
        self.assert_status_equal(response, status.HTTP_204_NO_CONTENT)
29
        self.assertEqual(response.data, None)
30
        self.assertTrue(self.signal_sent)
31
32
    def test_post_should_deny_logging_out_when_user_not_logged_in(self):
0 ignored issues
show
Coding Style Naming introduced by
The name test_post_should_deny_lo...when_user_not_logged_in 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...
33
        create_user()
34
        request = self.factory.post()
35
36
        response = self.view(request)
37
38
        self.assert_status_equal(response, status.HTTP_401_UNAUTHORIZED)
39
40
    def test_options(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...
41
        user = create_user()
42
        request = self.factory.options(user=user)
43
44
        response = self.view(request)
45
46
        self.assert_status_equal(response, status.HTTP_200_OK)
47