예제 #1
0
    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)
예제 #2
0
    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)
예제 #3
0
    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')
예제 #4
0
    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')
예제 #5
0
    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)
예제 #6
0
    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)