From 158eb17907d44359766584ec41aa82a96a1feaf9 Mon Sep 17 00:00:00 2001 From: Jon Date: Fri, 7 Jun 2024 22:12:51 +0930 Subject: [PATCH] test: during unit tests add SECRET_KEY required so that tests run !20 --- app/app/settings.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/app/settings.py b/app/app/settings.py index 44a57b5b..6188a329 100644 --- a/app/app/settings.py +++ b/app/app/settings.py @@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/5.0/ref/settings/ """ import os +import sys from pathlib import Path from split_settings.tools import optional, include @@ -113,7 +114,7 @@ WSGI_APPLICATION = 'app.wsgi.application' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': BASE_DIR / 'db.sqlite3', + 'NAME': str(BASE_DIR / 'db.sqlite3'), } } @@ -233,6 +234,14 @@ if API_ENABLED: } DATETIME_FORMAT = 'j N Y H:i:s' +# +# Settings for unit tests +# + +RUNNING_TESTS = 'test' in str(sys.argv) + +if RUNNING_TESTS: + SECRET_KEY = 'django-insecure-tests_are_being_run' # # Load user settings files