Exemple #1
0
def sequence_pipeline(message):
    """Sequence pipeline.

    Send to test backend twice.
    """
    yield send(NullOutput(test_arg=2))
    yield send(NullOutput(test_arg=1))
Exemple #2
0
def test_set_status():
    """Test route status update.
    """
    message = Message(id='test_message', event_type='test_event')
    effect = send(NullOutput())
    message.set_route_status(effect, 1)
    assert message.get_route_status(effect) == 1
Exemple #3
0
def test_update_state():
    """Test route state update.
    """
    message = Message(id='test_message', event_type='test_event')
    effect = send(NullOutput())
    message.set_route_state(effect, {'a': 1})
    assert message.get_route_state(effect) == {'a': 1}
Exemple #4
0
def test_route():
    msg = Message(event_type='example_event', event_id='123')
    assert msg.route == []

    expected_output = NullOutput()

    effect = send(expected_output)
    route = Route(effect=effect)
Exemple #5
0
def all_dummy_pipeline(message):
    available_outputs = (
        ConsoleOutput,
        CheckOutput,
        RetryOutput,
        NeverDeliveredOutput,
    )

    for dummy_output in available_outputs:
        yield send(dummy_output())
Exemple #6
0
def test_route_serialize():
    """Test route serialization.
    """
    expected_output = NullOutput()
    effect = send(expected_output)
    route = Route(effect=effect)

    msg = Message.from_dict({
        'event_type': 'example_event',
        'event_id': '123',
        'route': [route.serialize()]
    })

    assert msg.route[0].serialize() == route.serialize()
Exemple #7
0
def example_pipeline(message):
    yield send(RetryOutput(), NeverDeliveredOutput())
    yield send(ConsoleOutput())
Exemple #8
0
def failing_output_pipeline(message):
    yield send(FailingOutput())
Exemple #9
0
def simple_pipeline(message):
    """Simple pipeline.

    Send message through test delivery backend
    """
    yield send(NullOutput(), NullOutput())