bumblebee-status/tests/modules/test_modules.py
Tobi-wan Kenobi 252260c249 [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
2016-12-09 08:23:53 +01:00

33 lines
1.1 KiB
Python

# pylint: disable=C0103,C0111
import unittest
import importlib
from bumblebee.modules.cpu import Module
from bumblebee.engine import modules
from bumblebee.config import Config
from tests.util import assertWidgetAttributes, MockEngine
class TestGenericModules(unittest.TestCase):
def setUp(self):
engine = MockEngine()
config = Config()
self.objects = {}
for mod in modules():
cls = importlib.import_module("bumblebee.modules.{}".format(mod["name"]))
self.objects[mod["name"]] = getattr(cls, "Module")(engine, { "config": config })
def test_widgets(self):
for mod in self.objects:
widgets = self.objects[mod].widgets()
for widget in widgets:
assertWidgetAttributes(self, widget)
def test_update(self):
for mod in self.objects:
widgets = self.objects[mod].widgets()
self.objects[mod].update(widgets)
self.test_widgets()
self.assertEquals(widgets, self.objects[mod].widgets())
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4