Beispiel #1
0
    def test_filter(self):
        callback = Mock()
        filt = filter_callback(callback, ['add', 'mul'])
        t1 = {'task': 'add'}
        t2 = {'task': 'div'}

        message = Mock()
        filt(t2, message)
        self.assertFalse(callback.called)
        filt(t1, message)
        callback.assert_called_with(t1, message)
    def test_filter(self):
        callback = Mock()
        filt = filter_callback(callback, ['add', 'mul'])
        t1 = {'task': 'add'}
        t2 = {'task': 'div'}

        message = Mock()
        filt(t2, message)
        callback.assert_not_called()
        filt(t1, message)
        callback.assert_called_with(t1, message)
Beispiel #3
0
    def test_filter(self):
        callback = Mock()
        filt = filter_callback(callback, ["add", "mul"])
        t1 = {"task": "add"}
        t2 = {"task": "div"}

        message = Mock()
        filt(t2, message)
        callback.assert_not_called()
        filt(t1, message)
        callback.assert_called_with(t1, message)