def test_plugin_start_plugin(self): '''Stores the name of the function call and arguments in calls''' plugin = FakeJunebugPlugin() config = yield self.create_channel_config() yield plugin.start_plugin({'test': 'plugin_config'}, config) [(name, [plugin_config, config_arg])] = plugin.calls self.assertEqual(name, 'start_plugin') self.assertEqual(config_arg, config) self.assertEqual(plugin_config, {'test': 'plugin_config'})
def test_start_channel_plugins_called(self): '''Starting a channel should call `channel_started` on all plugins''' plugin = FakeJunebugPlugin() plugin.calls = [] channel = yield self.create_channel( self.service, self.redis, plugins=[plugin]) [(name, [plugin_channel])] = plugin.calls self.assertEqual(name, 'channel_started') self.assertEqual(plugin_channel, channel)
def test_plugin_channel_stopped(self): '''Stores the name of the function call and arguments in calls''' plugin = FakeJunebugPlugin() config = yield self.create_channel_config() yield plugin.start_plugin({'test': 'plugin_config'}, config) plugin.calls = [] redis = yield self.get_redis() channel = Channel( redis, config, deepcopy(self.default_channel_properties)) yield plugin.channel_stopped(channel) [(name, [channel_arg])] = plugin.calls self.assertEqual(name, 'channel_stopped') self.assertEqual(channel_arg, channel)
def test_plugin_channel_stopped(self): '''Stores the name of the function call and arguments in calls''' plugin = FakeJunebugPlugin() config = yield self.create_channel_config() yield plugin.start_plugin({'test': 'plugin_config'}, config) plugin.calls = [] redis = yield self.get_redis() channel = Channel(redis, config, deepcopy(self.default_channel_properties)) yield plugin.channel_stopped(channel) [(name, [channel_arg])] = plugin.calls self.assertEqual(name, 'channel_stopped') self.assertEqual(channel_arg, channel)