Skip to content

Commit

Permalink
Update settings during unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
ropable committed Aug 14, 2023
1 parent 9ae30df commit c4658bb
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ jobs:
run: |
source .venv/bin/activate
python manage.py collectstatic
python manage.py test --noinput --failfast --parallel 4 --verbosity 0
python manage.py test --noinput --failfast --parallel 4 --verbosity 0 --settings prs2.settings-test
31 changes: 31 additions & 0 deletions prs2/settings-test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import logging
from .settings import *

# Modify project settings to speed up unit tests.
logging.disable(logging.CRITICAL)
DEBUG = False
TEMPLATES[0]['OPTIONS'] = {
'debug': False,
'context_processors': [
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.request',
'django.template.context_processors.csrf',
'django.contrib.messages.context_processors.messages',
'prs2.context_processors.template_context',
],
}
PASSWORD_HASHERS = (
'django.contrib.auth.hashers.MD5PasswordHasher',
)
DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

0 comments on commit c4658bb

Please sign in to comment.