[modules/datetime] Use parameter functionality to get format

Make the format string of the datetime module configurable using the new
parameter() method in the module.

Also, restructured the setting of the config information a bit so that
the parameter() method can be used in the constructor of a module.

see #23
This commit is contained in:
Tobi-wan Kenobi 2016-12-09 08:23:53 +01:00
parent f33711f49f
commit 252260c249
6 changed files with 26 additions and 26 deletions

View file

@ -16,18 +16,20 @@ class TestModule(unittest.TestCase):
widgets=[self.widget, self.widget, self.widget]
)
self.anyModule = Module(engine=None, widgets = self.widget)
self.anotherModule = Module(engine=None, widgets = self.widget)
self.anyConfigName = "cfg"
self.anotherConfigName = "cfg2"
self.anyModule = Module(engine=None, widgets=self.widget, config={
"name": self.anyConfigName, "config": self.config
})
self.anotherModule = Module(engine=None, widgets=self.widget, config={
"name": self.anotherConfigName, "config": self.config
})
self.anyKey = "some-parameter"
self.anyValue = "value"
self.anotherValue = "another-value"
self.emptyKey = "i-do-not-exist"
self.config.set("{}.{}".format(self.anyConfigName, self.anyKey), self.anyValue)
self.config.set("{}.{}".format(self.anotherConfigName, self.anyKey), self.anotherValue)
self.anyModule.set_config(self.config, self.anyConfigName)
self.anotherModule.set_config(self.config, self.anotherConfigName)
def test_empty_widgets(self):
self.assertEquals(self.moduleWithoutWidgets.widgets(), [])