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

test_djoser_serializer_setting_overriden()   A

Complexity

Conditions 2

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
cc 2
c 2
b 0
f 1
dl 0
loc 6
rs 9.4285
1
from django.conf import settings
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.conf'
Loading history...
2
from django.test.utils import override_settings
0 ignored issues
show
introduced by
Unable to import 'django.test.utils'
Loading history...
3
from django.utils import six
0 ignored issues
show
introduced by
Unable to import 'django.utils'
Loading history...
4
from django.utils.module_loading import import_string
0 ignored issues
show
introduced by
Unable to import 'django.utils.module_loading'
Loading history...
5
6
7
@override_settings(DJOSER=dict())
8
def test_settings_should_be_default_if_djoser_not_in_django_settings():
0 ignored issues
show
Coding Style Naming introduced by
The name test_settings_should_be_..._not_in_django_settings 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...
9
    from djoser.conf import settings as djoser_settings
10
    from djoser.conf import default_settings
11
12
    for setting_name, setting_value in six.iteritems(default_settings):
13
        overridden_value = getattr(djoser_settings, setting_name)
14
        try:
15
            assert setting_value == overridden_value
16
        except AssertionError:
17
            setting_value = import_string(setting_value)
18
            assert setting_value == overridden_value
19
20
21
@override_settings(
22
    DJOSER=dict(settings.DJOSER, **{'USERNAME_UPDATE_REQUIRE_RETYPE': True})
23
)
0 ignored issues
show
Coding Style Naming introduced by
The name test_djoser_simple_setting_overriden 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
def test_djoser_simple_setting_overriden():
25
    from djoser.conf import settings as djoser_settings
26
    assert djoser_settings.USERNAME_UPDATE_REQUIRE_RETYPE
27
28
29
@override_settings(DJOSER=dict(settings.DJOSER, **{
30
    'SERIALIZERS': {'fake': 'djoser.serializers.TokenSerializer'}
31
}))
0 ignored issues
show
Coding Style Naming introduced by
The name test_djoser_serializer_setting_overriden 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
def test_djoser_serializer_setting_overriden():
33
    from djoser.conf import settings as djoser_settings
34
    assert djoser_settings.SERIALIZERS.user.__name__, 'TokenSerializer'
35