From cd75b9d55bcb91c1edcca3666b6b2d8b16af6ac2 Mon Sep 17 00:00:00 2001
From: Jorrit Schaap <schaap@astron.nl>
Date: Tue, 4 Aug 2020 14:08:39 +0200
Subject: [PATCH] TMSS-287: indicate (via environment var) that we are using
 the TMSSTestEnvironment during unittesting.

---
 SAS/TMSS/test/tmss_database_unittest_setup.py         | 4 ++++
 SAS/TMSS/test/tmss_test_environment_unittest_setup.py | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/SAS/TMSS/test/tmss_database_unittest_setup.py b/SAS/TMSS/test/tmss_database_unittest_setup.py
index adc9193ff72..812464c3e91 100644
--- a/SAS/TMSS/test/tmss_database_unittest_setup.py
+++ b/SAS/TMSS/test/tmss_database_unittest_setup.py
@@ -22,6 +22,10 @@ By importing this helper module in your unittest module you get a TMSSTestDataba
 which is automatically destroyed at the end of the unittest session.
 '''
 
+# indicate that we're unittesting.
+import os
+os.environ['TMSS_UNIT_TESTING'] = str(True)
+
 # before we import any django modules the DJANGO_SETTINGS_MODULE and TMSS_DBCREDENTIALS need to be known/set.
 # import and start an isolated TMSSTestDatabaseInstance (with fresh database)
 # this automagically sets the required  DJANGO_SETTINGS_MODULE and TMSS_DBCREDENTIALS envvars.
diff --git a/SAS/TMSS/test/tmss_test_environment_unittest_setup.py b/SAS/TMSS/test/tmss_test_environment_unittest_setup.py
index 98375bb80e3..a8c658c962f 100644
--- a/SAS/TMSS/test/tmss_test_environment_unittest_setup.py
+++ b/SAS/TMSS/test/tmss_test_environment_unittest_setup.py
@@ -22,6 +22,10 @@ By importing this helper module in your unittest module you get a TMSSTestDataba
 which is automatically destroyed at the end of the unittest session.
 '''
 
+# indicate that we're unittesting.
+import os
+os.environ['TMSS_UNIT_TESTING'] = str(True)
+
 import logging
 logger = logging.getLogger(__name__)
 
-- 
GitLab