diff --git a/pyproject.toml b/pyproject.toml index a4061d2..9c8296f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,7 +54,7 @@ ignore = "E203,W503" extend_exclude = "src/servala/static/mazer" [tool.pytest.ini_options] -DJANGO_SETTINGS_MODULE = "servala.settings" +DJANGO_SETTINGS_MODULE = "servala.settings_test" addopts = "-p no:doctest -p no:pastebin -p no:nose --cov=./ --cov-report=term-missing:skip-covered" testpaths = "src/tests" pythonpath = "src" diff --git a/src/servala/settings_test.py b/src/servala/settings_test.py new file mode 100644 index 0000000..477ecb2 --- /dev/null +++ b/src/servala/settings_test.py @@ -0,0 +1,37 @@ +""" +Django test settings that extend the main settings. + +This file imports all settings from the main settings module and +overrides/adds settings specific to testing. +""" + +from servala.settings import * # noqa: F403, F401 + +SECRET_KEY = "test-secret-key-for-testing-only-do-not-use-in-production" +PASSWORD_HASHERS = [ + "django.contrib.auth.hashers.MD5PasswordHasher", +] + + +class DisableMigrations: + def __contains__(self, item): + return True + + def __getitem__(self, item): + return None + + +MIGRATION_MODULES = DisableMigrations() + +DATABASES = { + "default": { + "ENGINE": "django.db.backends.sqlite3", + "NAME": ":memory:", + "OPTIONS": {"timeout": 10}, + } +} + +OSB_USERNAME = "testuser" +OSB_PASSWORD = "testpass" + +EMAIL_BACKEND = "django.core.mail.backends.locmem.EmailBackend"