def test_error_widget(): cfg = core.config.Config(shlex.split("-p test_module.foo=5")) module = core.module.Error("test-mod", "xyz", config=cfg) full_text = module.full_text(module.widget()) assert module.state(None) == ["critical"] assert "test-mod" in full_text assert "xyz" in full_text
def test_error_widget(self): cfg = core.config.Config(shlex.split("-p test_module.foo=5")) module = core.module.Error(cfg, "test-mod", "xyz") self.assertEqual(["critical"], module.state(None), "error module must have critical state") full_text = module.full_text(module.widget()) self.assertTrue("test-mod" in full_text) self.assertTrue("xyz" in full_text)
def test_loadvalid_module(self): module = core.module.load(module_name=self.validModuleName) self.assertEqual( "modules.core.{}".format(self.validModuleName), module.__class__.__module__, "module must be a modules.core.<name> object", ) self.assertEqual( "Module", module.__class__.__name__, "a valid module must have a Module class", ) self.assertEqual([], module.state(None), "default state of module is empty")
def test_loadvalid_module(): module = core.module.load(module_name="test") assert module.__class__.__module__ == "modules.core.test" assert module.__class__.__name__ == "Module" assert module.state(None) == []