def test_event_dispatch_specific_method(self): """ Tests if events are being dispatched for all plugins """ event_handler = EventHandler([TestPlugin()]) result = event_handler.dispatch('on_before_parse_args', [optparse.OptionParser()]) for plugin in event_handler._plugins: self.assertEqual("on_before_parse_args", result[plugin.name()])
def test_initial_state(self): """ Tests if on init everything is clear """ event_handler = EventHandler([]) self.assertEqual(event_handler._plugins, []) plugins = [TestPlugin()] event_handler = EventHandler(plugins) self.assertEqual(event_handler._plugins, plugins)
def test_event_dispatch_default_method(self): """ Tests if events are being dispatched for all plugins """ event_handler = EventHandler([TestPlugin()]) result = event_handler.dispatch('on_after_parse_args', [dict()]) for plugin in event_handler._plugins: self.assertEqual("on_after_parse_args", result[plugin.name()])