-
-
Notifications
You must be signed in to change notification settings - Fork 224
Expand file tree
/
Copy pathdjango_settings.py
More file actions
35 lines (27 loc) · 1.03 KB
/
django_settings.py
File metadata and controls
35 lines (27 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import pytest
from django.conf import LazySettings
@pytest.fixture(autouse=True)
def _media_root(
settings: LazySettings,
tmpdir_factory: pytest.TempPathFactory,
) -> None:
"""Forces django to save media files into temp folder."""
settings.MEDIA_ROOT = tmpdir_factory.mktemp('media', numbered=True)
@pytest.fixture(autouse=True)
def _password_hashers(settings: LazySettings) -> None:
"""Forces django to use fast password hashers for tests."""
settings.PASSWORD_HASHERS = [
'django.contrib.auth.hashers.MD5PasswordHasher',
]
@pytest.fixture(autouse=True)
def _auth_backends(settings: LazySettings) -> None:
"""Deactivates security backend from Axes app."""
settings.AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend',
)
@pytest.fixture(autouse=True)
def _debug(settings: LazySettings) -> None:
"""Sets proper DEBUG and TEMPLATE debug mode for coverage."""
settings.DEBUG = False
for template in settings.TEMPLATES:
template['OPTIONS']['debug'] = True