Нема описа
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

test_settings.py 1.3KB

1234567891011121314151617181920212223242526272829303132
  1. #-*- coding: utf-8 -*-
  2. import unittest
  3. from unittest import mock
  4. import tests.loader_utils
  5. from lodel.settings.settings import Settings
  6. from lodel.settings.settings import SettingsLoader
  7. from lodel.settings.utils import SettingsError, SettingsErrors
  8. def dummy_validator(value): return value
  9. class SettingsTestCase(unittest.TestCase):
  10. def test_init(self):
  11. with self.assertRaises(RuntimeError):
  12. Settings('conf.d')
  13. #@unittest.skip("This tests doesn't pass anymore, but I do not understand why it should pass")
  14. def test_set(self):
  15. Settings.set('lodel2.editorialmodel.emfile','test ok', dummy_validator)
  16. Settings.set('lodel2.editorialmodel.editormode','test ok', dummy_validator)
  17. loader = SettingsLoader('conf.d')
  18. option = loader.getoption('lodel2.editorialmodel','emfile', dummy_validator)
  19. option = loader.getoption('lodel2.editorialmodel','editormode', dummy_validator)
  20. self.assertEqual(option , 'test ok')
  21. option = loader.getoption('lodel2.editorialmodel','editormode', dummy_validator)
  22. self.assertEqual(option, 'test ok')
  23. Settings.set('lodel2.editorialmodel.emfile','examples/em_test.pickle', dummy_validator)
  24. Settings.set('lodel2.editorialmodel.editormode','True', dummy_validator)