|
@@ -15,21 +15,22 @@ class SettingsLoaderTestCase(unittest.TestCase):
|
15
|
15
|
def test_merge_getsection(self):
|
16
|
16
|
"""Tests merge and getSection functions """
|
17
|
17
|
settings = SettingsLoader('tests/settings/conf.d')
|
18
|
|
-
|
19
|
|
- e=settings.getoption('A','a',dummy_validator)
|
|
18
|
+ def maFonction(a):
|
|
19
|
+ return a
|
|
20
|
+ e=settings.getoption('A','a',maFonction)
|
20
|
21
|
self.assertEqual(e,'a1')
|
21
|
|
- f=settings.getoption('B','bb',dummy_validator)
|
|
22
|
+ f=settings.getoption('B','bb',maFonction)
|
22
|
23
|
self.assertEqual(f,"bj,kl,mn")
|
23
|
24
|
g=settings.getremains()
|
24
|
25
|
self.assertIsNotNone(g)
|
25
|
|
- e=settings.getoption('A','b',dummy_validator)
|
26
|
|
- e=settings.getoption('A','c',dummy_validator)
|
27
|
|
- e=settings.getoption('A','fhui',dummy_validator)
|
28
|
|
- f=settings.getoption('B','ab',dummy_validator)
|
29
|
|
- f=settings.getoption('B','cb',dummy_validator)
|
30
|
|
- f=settings.getoption('C','cb',dummy_validator)
|
31
|
|
- f=settings.getoption('C','ca',dummy_validator)
|
32
|
|
- f=settings.getoption('C','cc',dummy_validator)
|
|
26
|
+ e=settings.getoption('A','b',maFonction)
|
|
27
|
+ e=settings.getoption('A','c',maFonction)
|
|
28
|
+ e=settings.getoption('A','fhui',maFonction)
|
|
29
|
+ f=settings.getoption('B','ab',maFonction)
|
|
30
|
+ f=settings.getoption('B','cb',maFonction)
|
|
31
|
+ f=settings.getoption('C','cb',maFonction)
|
|
32
|
+ f=settings.getoption('C','ca',maFonction)
|
|
33
|
+ f=settings.getoption('C','cc',maFonction)
|
33
|
34
|
|
34
|
35
|
g=settings.getremains()
|
35
|
36
|
self.assertEqual(g,[])
|
|
@@ -66,7 +67,7 @@ class SettingsLoaderTestCase(unittest.TestCase):
|
66
|
67
|
""" Testing variable section default value handling """
|
67
|
68
|
loader = SettingsLoader('tests/settings/settings_examples/var_sections.conf.d')
|
68
|
69
|
sections = loader.getsection('lodel2.notexisting', 'foobar')
|
69
|
|
- self.assertEqual(set(sections), set(('lodel2.foobar',)))
|
|
70
|
+ self.assertEqual(set(sections), set(('lodel2.notexisting.foobar',)))
|
70
|
71
|
|
71
|
72
|
def test_variable_sections_fails(self):
|
72
|
73
|
""" Testing behavior when no default section given for a non existing variable section """
|