def test_disabled_regex(self): regex = compile("command") c = util.regex(regex) c(regex_f) pluginmanager.disable(regex.pattern) self.assertFalse(pluginmanager._regexes[regex].enabled) pluginmanager._handle_message("user", "channel", "command")
def test_disabled_command(self): c = util.command("command", aliases=["foo"]) c(f3) pluginmanager.disable("command") self.assertFalse(pluginmanager._callbacks["command"].enabled) self.assertFalse(pluginmanager._callbacks["foo"].enabled) pluginmanager._handle_message("user", "channel", "!command")
def test_reenabled_command(self): c = util.command("command", aliases=["foo"]) c(f3) pluginmanager.disable("command") pluginmanager.enable("command") self.assertTrue(pluginmanager._callbacks["command"].enabled) self.assertTrue(pluginmanager._callbacks["foo"].enabled) self.assertRaises(ValueError, pluginmanager._handle_message, "user", "channel", "!command")
def test_reenabled_regex(self): regex = compile("command") c = util.regex(regex) c(regex_f) pluginmanager.disable(regex.pattern) pluginmanager.enable(regex.pattern) self.assertTrue(pluginmanager._regexes[regex].enabled) self.assertRaises(ValueError, pluginmanager._handle_message, "user", "channel", "command")