mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2025-02-06 14:40:48 +03:00
Add test for option.from_ini() missing envs not required
This commit is contained in:
parent
35a46bdb7f
commit
6173e1b7b6
|
@ -654,6 +654,31 @@ class ConfigFromIniWithEnvInterpolationTests(unittest.TestCase):
|
||||||
self.assertEqual(self.config.section1.value1(), '')
|
self.assertEqual(self.config.section1.value1(), '')
|
||||||
self.assertEqual(self.config.section1.value2(), '/path')
|
self.assertEqual(self.config.section1.value2(), '/path')
|
||||||
|
|
||||||
|
def test_option_missing_envs(self):
|
||||||
|
del os.environ['CONFIG_TEST_ENV']
|
||||||
|
del os.environ['CONFIG_TEST_PATH']
|
||||||
|
|
||||||
|
self.config.option.from_ini(self.config_file)
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
self.config.option(),
|
||||||
|
{
|
||||||
|
'section1': {
|
||||||
|
'value1': '',
|
||||||
|
'value2': '/path',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
self.config.option.section1(),
|
||||||
|
{
|
||||||
|
'value1': '',
|
||||||
|
'value2': '/path',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
self.assertEqual(self.config.option.section1.value1(), '')
|
||||||
|
self.assertEqual(self.config.option.section1.value2(), '/path')
|
||||||
|
|
||||||
def test_default_values(self):
|
def test_default_values(self):
|
||||||
os.environ['DEFINED'] = 'defined'
|
os.environ['DEFINED'] = 'defined'
|
||||||
self.addCleanup(os.environ.pop, 'DEFINED')
|
self.addCleanup(os.environ.pop, 'DEFINED')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user