Passed
Pull Request — master (#259)
by Piotr
01:33
created

test_valid_user_create_with_trailing_slash()   A

Complexity

Conditions 3

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
c 1
b 0
f 0
dl 0
loc 10
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 django.contrib.auth import get_user_model
0 ignored issues
show
introduced by
Unable to import 'django.contrib.auth'
Loading history...
4
from rest_framework import status
0 ignored issues
show
introduced by
Unable to import 'rest_framework'
Loading history...
5
from rest_framework.test import APIClient
0 ignored issues
show
introduced by
Unable to import 'rest_framework.test'
Loading history...
6
7
User = get_user_model()
0 ignored issues
show
Coding Style Naming introduced by
The name User 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.

Loading history...
8
9
10
@pytest.mark.django_db(transaction=False)
11
def test_valid_user_create_with_trailing_slash():
0 ignored issues
show
Coding Style Naming introduced by
The name test_valid_user_create_with_trailing_slash 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...
12
    client = APIClient()
13
    response = client.post('/users/', {
14
        User.USERNAME_FIELD: 'test@localhost',
15
        'password': 'testing123',
16
    })
17
18
    assert response.status_code == status.HTTP_201_CREATED
19
    assert response.json() == {User.USERNAME_FIELD: 'test@localhost', 'id': 1}
20
21
22
@pytest.mark.django_db(transaction=False)
23
def test_valid_user_create_without_trailing_slash():
0 ignored issues
show
Coding Style Naming introduced by
The name test_valid_user_create_without_trailing_slash 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...
24
    client = APIClient()
25
    response = client.post('/users', {
26
        User.USERNAME_FIELD: 'test@localhost',
27
        'password': 'testing123',
28
    })
29
30
    assert response.status_code == status.HTTP_201_CREATED
31
    assert response.json() == {User.USERNAME_FIELD: 'test@localhost', 'id': 1}
32