[core/config] Add interval (as parameter store)

Add a generic parameter store to the configuration and use it to set the
parameter "interval" (backwards compatibility)
This commit is contained in:
Tobias Witek 2020-01-25 14:24:21 +01:00
parent 8a2ef5ea5d
commit 5a60a23ebd
3 changed files with 32 additions and 4 deletions

View file

@ -10,12 +10,24 @@ class config(unittest.TestCase):
def tearDown(self):
pass
def test_module_parameter(self):
def test_module(self):
cfg = core.config.Config([ '-m' ] + self._someModules)
self.assertEqual(self._someModules, cfg.modules())
def test_module_parameter_ordering_maintained(self):
def test_module_ordering_maintained(self):
cfg = core.config.Config([ '-m' ] + self._someModules + [ '-m' ] + self._moreModules)
self.assertEqual(self._someModules + self._moreModules, cfg.modules())
def test_default_interval(self):
cfg = core.config.Config([])
self.assertEqual(1, cfg.interval())
def test_interval(self):
cfg = core.config.Config([ '-p', 'interval=4'])
self.assertEqual(4, cfg.interval())
def test_float_interval(self):
cfg = core.config.Config([ '-p', 'interval=0.5'])
self.assertEqual(0.5, cfg.interval())
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4