test.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. from .base import * # noqa
  2. from .base import STORAGES
  3. # #############
  4. # General
  5. ALLOWED_HOSTS = ["*"]
  6. # Don't redirect to HTTPS in tests or send the HSTS header
  7. SECURE_SSL_REDIRECT = False
  8. SECURE_HSTS_SECONDS = 0
  9. STORAGES["staticfiles"]["BACKEND"] = (
  10. "django.contrib.staticfiles.storage.StaticFilesStorage"
  11. )
  12. # Use local memory caching instead of redis when testing locally
  13. # to prevent caching shenanigans
  14. CACHES = {
  15. "default": {
  16. "BACKEND": "django.core.cache.backends.locmem.LocMemCache",
  17. }
  18. }
  19. # Wagtail
  20. WAGTAILADMIN_BASE_URL = "http://localhost:8000"
  21. # Task queue configuration to ensure tasks run immediately in the test environment
  22. # https://docs.wagtail.org/en/stable/releases/6.4.html#background-tasks-run-at-end-of-current-transaction
  23. TASKS = {
  24. "default": {
  25. "BACKEND": "django_tasks.backends.immediate.ImmediateBackend",
  26. "ENQUEUE_ON_COMMIT": False,
  27. }
  28. }
  29. # #############
  30. # Performance
  31. # By default, Django uses a computationally difficult algorithm for passwords hashing.
  32. # We don't need such a strong algorithm in tests, so use MD5
  33. PASSWORD_HASHERS = ["django.contrib.auth.hashers.MD5PasswordHasher"]