No Description
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_loader.py 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #-*- coding: utf-8 -*-
  2. import unittest
  3. import tests.loader_utils
  4. from lodel.settings.settings_loader import SettingsLoader
  5. class SettingsLoaderTestCase(unittest.TestCase):
  6. def test_merge_getsection(self):
  7. """Tests merge and getSection functions """
  8. settings = SettingsLoader('tests/settings/conf.d')
  9. a = settings.getsection('A')
  10. self.assertEqual(a,dict({"a":"a1","b":"b1,b2,b3","c":"toto","fhui":"njl"}))
  11. b = settings.getsection('B')
  12. self.assertEqual(b,dict({"ab":"art","bb":"bj,kl,mn","cb":"tatat"}))
  13. c = settings.getsection('C')
  14. self.assertEqual(c,dict({"ca":"a2","cb":"b4,b2,b3","cc":"titi"}))
  15. d = settings.getsection('D')
  16. for v in a:
  17. assert ('A','{"a":"a1","b":"b1,b2,b3","c":"toto","fhui":"njl"}')
  18. def maFonction(a):
  19. return a
  20. e=settings.getoption('A','a',maFonction)
  21. self.assertEqual(e,'a1')
  22. f=settings.getoption('B','bb',maFonction)
  23. self.assertEqual(f,"bj,kl,mn")
  24. g=settings.getremains()
  25. self.assertIsNotNone(g)
  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)
  34. g=settings.getremains()
  35. self.assertEqual(g,[])