def test_stop_channel_plugins_called(self): '''Stopping a channel should call `channel_stopped` on all plugins''' plugin = FakeJunebugPlugin() plugin.calls = [] channel = yield self.create_channel( self.service, self.redis, plugins=[plugin]) plugin.calls = [] yield channel.stop() [(name, [plugin_channel])] = plugin.calls self.assertEqual(name, 'channel_stopped') self.assertEqual(plugin_channel, channel)
def test_plugin_stop_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) plugin.calls = [] yield plugin.stop_plugin() [(name, [])] = plugin.calls self.assertEqual(name, 'stop_plugin')
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)