Skip to content

Commit 6173e1b

Browse files
committed
Add test for option.from_ini() missing envs not required
1 parent 35a46bd commit 6173e1b

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/unit/providers/test_configuration_py2_py3.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,31 @@ def test_missing_envs(self):
654654
self.assertEqual(self.config.section1.value1(), '')
655655
self.assertEqual(self.config.section1.value2(), '/path')
656656

657+
def test_option_missing_envs(self):
658+
del os.environ['CONFIG_TEST_ENV']
659+
del os.environ['CONFIG_TEST_PATH']
660+
661+
self.config.option.from_ini(self.config_file)
662+
663+
self.assertEqual(
664+
self.config.option(),
665+
{
666+
'section1': {
667+
'value1': '',
668+
'value2': '/path',
669+
},
670+
},
671+
)
672+
self.assertEqual(
673+
self.config.option.section1(),
674+
{
675+
'value1': '',
676+
'value2': '/path',
677+
},
678+
)
679+
self.assertEqual(self.config.option.section1.value1(), '')
680+
self.assertEqual(self.config.option.section1.value2(), '/path')
681+
657682
def test_default_values(self):
658683
os.environ['DEFINED'] = 'defined'
659684
self.addCleanup(os.environ.pop, 'DEFINED')

0 commit comments

Comments
 (0)