From 242a5c1d41600a468a9000f56e0927d6ca603294 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Sun, 8 Dec 2019 14:34:54 -0400 Subject: [PATCH] Add test for GitLab issue #702 Signed-off-by: Roberto Rosario --- HISTORY.rst | 1 + .../apps/smart_settings/tests/test_classes.py | 32 ++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index 8dacefb56a..bc19dfb992 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,6 +7,7 @@ - Update devpi-server version to 5.3.1. - Add targets to run staging containers using RabbitMQ as broker. +- Add test for GitLab issue #702 3.3.3 (2019-12-05) ================== diff --git a/mayan/apps/smart_settings/tests/test_classes.py b/mayan/apps/smart_settings/tests/test_classes.py index 7eae2eca3b..19f3c8a9fd 100644 --- a/mayan/apps/smart_settings/tests/test_classes.py +++ b/mayan/apps/smart_settings/tests/test_classes.py @@ -23,7 +23,37 @@ from .mocks import ( ) -class ClassesTestCase(EnvironmentTestCaseMixin, SmartSettingTestMixin, BaseTestCase): +class ClassesTestCase( + EnvironmentTestCaseMixin, SmartSettingTestMixin, BaseTestCase +): + def test_environment_override(self): + test_environment_value = 'test environment value' + test_file_value = 'test file value' + + self._create_test_settings_namespace() + self._create_test_setting() + + self._set_environment_variable( + name='MAYAN_{}'.format(TEST_SETTING_GLOBAL_NAME), + value=test_environment_value + ) + + with NamedTemporaryFile() as file_object: + settings.CONFIGURATION_FILEPATH = file_object.name + file_object.write( + force_bytes( + '{}: {}'.format( + TEST_SETTING_GLOBAL_NAME, test_file_value + ) + ) + ) + file_object.seek(0) + Setting._config_file_cache = None + + self.assertEqual( + self.test_setting.value, test_environment_value + ) + def test_environment_variable(self): self._set_environment_variable( name='MAYAN_{}'.format(ENVIRONMENT_TEST_NAME),