|
@@ -3,14 +3,27 @@
|
3
|
3
|
import unittest
|
4
|
4
|
from unittest import mock
|
5
|
5
|
|
6
|
|
-"""
|
7
|
6
|
import tests.loader_utils
|
8
|
7
|
from lodel.settings.settings import Settings
|
|
8
|
+from lodel.settings.settings import SettingsLoader
|
|
9
|
+
|
|
10
|
+def dummy_validator(value): return value
|
9
|
11
|
|
10
|
12
|
class SettingsTestCase(unittest.TestCase):
|
11
|
13
|
|
12
|
|
- @unittest.skip('todo : write it')
|
13
|
14
|
def test_init(self):
|
14
|
|
- settings = Settings('tests/settings/settings_tests.ini', 'tests/settings/settings_tests_conf.d')
|
15
|
|
- pass
|
16
|
|
-"""
|
|
15
|
+ with self.assertRaises(RuntimeError):
|
|
16
|
+ Settings('tests/settings/settings_tests_conf.d')
|
|
17
|
+
|
|
18
|
+ def test_set(self):
|
|
19
|
+ loader = SettingsLoader('globconf.d')
|
|
20
|
+ Settings.set('lodel2.editorialmodel.emfile','test ok', dummy_validator, loader)
|
|
21
|
+ Settings.set('lodel2.editorialmodel.editormode','test ok', dummy_validator, loader)
|
|
22
|
+ loader = SettingsLoader('globconf.d')
|
|
23
|
+ option = loader.getoption('lodel2.editorialmodel','emfile', dummy_validator)
|
|
24
|
+ self.assertEqual(option , 'test ok')
|
|
25
|
+ option = loader.getoption('lodel2.editorialmodel','editormode', dummy_validator)
|
|
26
|
+ self.assertEqual(option, 'test ok')
|
|
27
|
+ Settings.set('lodel2.editorialmodel.emfile','examples/em_test.pickle', dummy_validator, loader)
|
|
28
|
+ Settings.set('lodel2.editorialmodel.editormode','True', dummy_validator, loader)
|
|
29
|
+
|