1 | from django.contrib.auth import get_user_model |
||
0 ignored issues
–
show
|
|||
2 | from django.db import IntegrityError |
||
3 | |||
4 | from djoser.conf import settings as djoser_settings |
||
0 ignored issues
–
show
|
|||
5 | |||
6 | try: |
||
7 | from unittest import mock |
||
8 | except ImportError: |
||
9 | import mock |
||
10 | |||
11 | __all__ = [ |
||
12 | "get_user_model", |
||
13 | "IntegrityError", |
||
14 | "mock", |
||
15 | "RunCheck", |
||
16 | "PermCheckClass", |
||
17 | "SerializerCheckClass", |
||
18 | ] |
||
19 | |||
20 | Token = djoser_settings.TOKEN_MODEL |
||
0 ignored issues
–
show
The name
Token does not conform to the constant naming conventions ((([A-Z_][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. ![]() |
|||
21 | |||
22 | |||
23 | def create_user(use_custom_data=False, **kwargs): |
||
0 ignored issues
–
show
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. ![]() |
|||
24 | data = ( |
||
25 | {"username": "john", "password": "secret", "email": "[email protected]"} |
||
26 | if not use_custom_data |
||
27 | else { |
||
28 | "custom_username": "john", |
||
29 | "password": "secret", |
||
30 | "custom_email": "[email protected]", |
||
31 | "custom_required_field": "42", |
||
32 | } |
||
33 | ) |
||
34 | data.update(kwargs) |
||
35 | user = get_user_model().objects.create_user(**data) |
||
36 | user.raw_password = data["password"] |
||
37 | return user |
||
38 | |||
39 | |||
40 | def login_user(client, user): |
||
0 ignored issues
–
show
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. ![]() |
|||
41 | token = Token.objects.create(user=user) |
||
42 | client.credentials(HTTP_AUTHORIZATION="Token " + token.key) |
||
43 | |||
44 | |||
45 | def perform_create_mock(x): |
||
0 ignored issues
–
show
The name
x does not conform to the argument 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. ![]() 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. ![]() |
|||
46 | raise IntegrityError |
||
47 | |||
48 | |||
49 | class RunCheck(Exception): |
||
0 ignored issues
–
show
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. ![]() |
|||
50 | pass |
||
51 | |||
52 | |||
53 | class PermCheckClass: |
||
0 ignored issues
–
show
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. ![]() |
|||
54 | def has_permission(self, *args, **kwargs): |
||
0 ignored issues
–
show
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. ![]() This method could be written as a function/class method.
If a method does not access any attributes of the class, it could also be implemented as a function or static method. This can help improve readability. For example class Foo:
def some_method(self, x, y):
return x + y;
could be written as class Foo:
@classmethod
def some_method(cls, x, y):
return x + y;
![]() |
|||
55 | raise RunCheck("working") |
||
56 | |||
57 | def has_object_permission(self, *args, **kwargs): |
||
0 ignored issues
–
show
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. ![]() This method could be written as a function/class method.
If a method does not access any attributes of the class, it could also be implemented as a function or static method. This can help improve readability. For example class Foo:
def some_method(self, x, y):
return x + y;
could be written as class Foo:
@classmethod
def some_method(cls, x, y):
return x + y;
![]() |
|||
58 | raise RunCheck("working") |
||
59 | |||
60 | |||
61 | class SerializerCheckClass: |
||
0 ignored issues
–
show
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. ![]() |
|||
62 | def __init__(self, *args, **kwargs): |
||
0 ignored issues
–
show
|
|||
63 | raise RunCheck("working") |
||
64 |
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.