From 2286e203ca9a4b44c29bc99ffc89cc2e68e85436 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 13 Mar 2022 20:23:18 +0100 Subject: [PATCH] test get_settings helper --- InvenTree/InvenTree/tests.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/InvenTree/InvenTree/tests.py b/InvenTree/InvenTree/tests.py index 277128cd2e..fa6f93562e 100644 --- a/InvenTree/InvenTree/tests.py +++ b/InvenTree/InvenTree/tests.py @@ -17,7 +17,7 @@ from . import helpers from . import version from . import status from . import ready -from .config import get_config_file, get_plugin_file +from .config import get_config_file, get_plugin_file, get_setting from decimal import Decimal @@ -473,4 +473,12 @@ class TestSettings(TestCase): self.env.set('INVENTREE_PLUGIN_FILE', 'my_special_plugins.txt') self.assertIn('my_special_plugins.txt', get_plugin_file()) - self.assertIn('InvenTree/InvenTree/plugins.txt', get_plugin_file()) + def test_helpers_setting(self): + TEST_ENV_NAME = '123TEST' + # check that default gets returned if not present + self.assertEqual(get_setting(TEST_ENV_NAME, None, '123!'), '123!') + + # with env set + with self.env: + self.env.set(TEST_ENV_NAME, '321') + self.assertEqual(get_setting(TEST_ENV_NAME, None), '321')