From f3169589435e753a00f34473941ac609c0d7ab38 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 1 Apr 2020 13:23:29 -0400 Subject: [PATCH] Establish a separate configuration file for testing --- netbox/netbox/configuration.testing.py | 36 ++++++++++++++++++++++++++ scripts/cibuild.sh | 6 ++--- 2 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 netbox/netbox/configuration.testing.py diff --git a/netbox/netbox/configuration.testing.py b/netbox/netbox/configuration.testing.py new file mode 100644 index 000000000..8d66515bb --- /dev/null +++ b/netbox/netbox/configuration.testing.py @@ -0,0 +1,36 @@ +################################################################### +# This file serves as a base configuration for testing purposes # +# only. It is not intended for production use. # +################################################################### + +ALLOWED_HOSTS = ['*'] + +DATABASE = { + 'NAME': 'netbox', + 'USER': '', + 'PASSWORD': '', + 'HOST': 'localhost', + 'PORT': '', + 'CONN_MAX_AGE': 300, +} + +REDIS = { + 'tasks': { + 'HOST': 'localhost', + 'PORT': 6379, + 'PASSWORD': '', + 'DATABASE': 0, + 'DEFAULT_TIMEOUT': 300, + 'SSL': False, + }, + 'caching': { + 'HOST': 'localhost', + 'PORT': 6379, + 'PASSWORD': '', + 'DATABASE': 1, + 'DEFAULT_TIMEOUT': 300, + 'SSL': False, + } +} + +SECRET_KEY = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' diff --git a/scripts/cibuild.sh b/scripts/cibuild.sh index 282000b0a..21ccfef67 100755 --- a/scripts/cibuild.sh +++ b/scripts/cibuild.sh @@ -34,11 +34,9 @@ if [[ $RC != 0 ]]; then EXIT=$RC fi -# Prepare configuration file for use in CI +# Point to the testing configuration file for use in CI CONFIG="netbox/netbox/configuration.py" -cp netbox/netbox/configuration.example.py $CONFIG -sed -i -e "s/ALLOWED_HOSTS = \[\]/ALLOWED_HOSTS = \['*'\]/g" $CONFIG -sed -i -e "s/SECRET_KEY = ''/SECRET_KEY = 'netboxci'/g" $CONFIG +ln -s netbox/netbox/configuration.testing.py $CONFIG # Run NetBox tests coverage run --source="netbox/" netbox/manage.py test netbox/