FreedomBox/plinth/tests/data/django_test_settings.py
Sunil Mohan Adapa 28c1d5eda3
web_framework, tests: Workaround captcha 0.5.6 vs. Django 3.2
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-09-18 08:36:46 -04:00

59 lines
1.4 KiB
Python

# SPDX-License-Identifier: AGPL-3.0-or-later
"""
Django settings for test modules.
"""
import os
# Workaround for django-simple-captcha 0.5.6 not being compatible with
# Django 3.2. 0.5.14 is almost there in Debian. Workaround only until then.
import django.utils.encoding
django.utils.encoding.python_2_unicode_compatible = lambda x: x
TEST_DATA_DIR = os.path.dirname(os.path.abspath(__file__))
AXES_ENABLED = False
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.dummy.DummyCache'
}
}
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(TEST_DATA_DIR, 'plinth.sqlite3'),
}
}
INSTALLED_APPS = [
'axes',
'captcha',
'bootstrapform',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.messages',
'stronghold',
'plinth',
]
# These are included here solely to suppress Django warnings
# during testing setup
MIDDLEWARE = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)
ROOT_URLCONF = 'plinth.tests.data.urls'
SECRET_KEY = 'django_tests_secret_key'
TEMPLATES = [{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'APP_DIRS': True,
'DIRS': ['plinth/tests/data/templates/'],
}]