def sequence_pipeline(message): """Sequence pipeline. Send to test backend twice. """ yield send(NullOutput(test_arg=2)) yield send(NullOutput(test_arg=1))
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
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}
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)
def all_dummy_pipeline(message): available_outputs = ( ConsoleOutput, CheckOutput, RetryOutput, NeverDeliveredOutput, ) for dummy_output in available_outputs: yield send(dummy_output())
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()
def example_pipeline(message): yield send(RetryOutput(), NeverDeliveredOutput()) yield send(ConsoleOutput())
def failing_output_pipeline(message): yield send(FailingOutput())
def simple_pipeline(message): """Simple pipeline. Send message through test delivery backend """ yield send(NullOutput(), NullOutput())