From 24df2d0a4afcd6c21ee4dc3bce38b8053c4f314e Mon Sep 17 00:00:00 2001
From: Todd Dembrey <todd.dembrey@torchbox.com>
Date: Wed, 29 Aug 2018 12:01:38 +0100
Subject: [PATCH] Update to make sure testing works well

---
 .circleci/config.yml            | 2 +-
 .travis.yml                     | 2 +-
 opentech/settings/production.py | 1 -
 opentech/settings/test.py       | 9 +++++++++
 requirements.txt                | 2 +-
 5 files changed, 12 insertions(+), 4 deletions(-)
 create mode 100644 opentech/settings/test.py

diff --git a/.circleci/config.yml b/.circleci/config.yml
index e65acb0cc..53914919f 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -14,7 +14,7 @@ jobs:
           DATABASE_URL: postgresql://root@localhost/opentech?sslmode=disable
           PGHOST: localhost
           PGUSER: root
-          DJANGO_SETTINGS_MODULE: opentech.settings.production
+          DJANGO_SETTINGS_MODULE: opentech.settings.test
           NPM_CONFIG_PRODUCTION: false
           SEND_MESSAGES: false
 
diff --git a/.travis.yml b/.travis.yml
index e726c0017..ca5466614 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -19,7 +19,7 @@ addons:
 
 env:
   global:
-    - DJANGO_SETTINGS_MODULE=opentech.settings.production
+    - DJANGO_SETTINGS_MODULE=opentech.settings.test
     - DATABASE_URL=postgres://postgres@localhost/test_db
 
 before_script:
diff --git a/opentech/settings/production.py b/opentech/settings/production.py
index 4c4978cc6..c4a21eedd 100644
--- a/opentech/settings/production.py
+++ b/opentech/settings/production.py
@@ -1,6 +1,5 @@
 import os
 
-# import raven
 import django_heroku
 
 from .base import *  # noqa
diff --git a/opentech/settings/test.py b/opentech/settings/test.py
new file mode 100644
index 000000000..89f1c83c9
--- /dev/null
+++ b/opentech/settings/test.py
@@ -0,0 +1,9 @@
+from .production import *  # noqa
+
+# Should only include explicit testing settings
+
+SECRET_KEY = 'NOT A SECRET'
+
+# Need this to ensure white noise doesn't kill the speed of testing
+# http://whitenoise.evans.io/en/latest/django.html#whitenoise-makes-my-tests-run-slow
+WHITENOISE_AUTOREFRESH = True
diff --git a/requirements.txt b/requirements.txt
index 8233fc584..ad50d6e16 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -31,7 +31,7 @@ django_select2==6.0.1
 dj-database-url==0.5.0
 django-basic-auth-ip-whitelist==0.2.1
 django-heroku==0.3.1
-whitenoise==3.3.1
+whitenoise==4.0
 gunicorn==19.9.0
 ConcurrentLogHandler==0.9.1
 raven==6.9.0
-- 
GitLab