test_settings.py 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import os
  2. from .settings import * # pylint: disable-all
  3. # Use test DB
  4. DATABASES = {
  5. 'default': {
  6. 'ENGINE': 'django.db.backends.postgresql_psycopg2',
  7. 'NAME': os.environ['POSTGRES_TEST_DB'],
  8. 'USER': os.environ['POSTGRES_USER'],
  9. 'PASSWORD': os.environ['POSTGRES_PASSWORD'],
  10. 'HOST': os.environ['POSTGRES_HOST'],
  11. 'PORT': 5432,
  12. }
  13. }
  14. # Use in-memory cache
  15. CACHES = {
  16. 'default': {
  17. 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
  18. 'LOCATION': 'uniqu3-sn0wf14k3'
  19. }
  20. }
  21. # Disable Debug Toolbar
  22. DEBUG_TOOLBAR_CONFIG = {}
  23. INTERNAL_IPS = []
  24. # Disable account validation via Stop Forum Spam
  25. MISAGO_NEW_REGISTRATIONS_VALIDATORS = (
  26. 'misago.users.validators.validate_gmail_email',
  27. )
  28. # Store mails in memory
  29. EMAIL_BACKEND = 'django.core.mail.backends.locmem.EmailBackend'
  30. # Use MD5 password hashing to speed up test suite
  31. PASSWORD_HASHERS = (
  32. 'django.contrib.auth.hashers.MD5PasswordHasher',
  33. )
  34. # Default misago address to test address
  35. MISAGO_ADDRESS = 'http://testserver/'
  36. # Use english search config
  37. MISAGO_SEARCH_CONFIG = 'english'
  38. # Register test post validator
  39. MISAGO_POST_VALIDATORS = [
  40. 'misago.core.testproject.validators.test_post_validator',
  41. ]
  42. # Register test post search filter
  43. MISAGO_POST_SEARCH_FILTERS = [
  44. 'misago.core.testproject.searchfilters.test_filter',
  45. ]
  46. # Additional overrides for Travis-CI
  47. if os.environ.get('TRAVIS'):
  48. DATABASES = {
  49. 'default': {
  50. 'ENGINE': 'django.db.backends.postgresql_psycopg2',
  51. 'NAME': 'travis_ci_test',
  52. 'USER': 'postgres',
  53. 'PASSWORD': '',
  54. 'HOST': '127.0.0.1',
  55. 'PORT': '',
  56. }
  57. }
  58. TEST_NAME = 'travis_ci_test'