Ejemplo n.º 1
0
def test_minimal_loopback_below():
    """Test for correct echo from send to receive with minimal stack."""
    print('Testing minimal application loopback with BottomLoopbackLink...')
    stack = AutomaticStack(BottomLoopbackLink(),
                           make_minimal(),
                           name='LoopbackBelow')
    print(stack)
    assert_loopback_below(stack, (1, 2, (3, {'foo': 'bar'})))
Ejemplo n.º 2
0
def test_pubsub_loopback_below():
    """Test for correct echo from send to receive with pub-sub stack."""
    print('Testing pub-sub application loopback with BottomLoopbackLink...')
    stack = AutomaticStack(BottomLoopbackLink(),
                           make_pubsub(),
                           name='LoopbackBelow')
    print(stack)
    topic = b'test'
    assert_loopback_below(stack, (topic, (1, 2, (3, {'foo': 'bar'}))))
Ejemplo n.º 3
0
def test_minimal_loopback_coupler():
    """Test for correct echo from send to receive."""
    print('Testing byte buffer loopback with PipelineBottomCoupler...')
    stack_one = make_minimal()
    stack_two = AutomaticStack(make_minimal(), TopLoopbackLink())
    coupler = PipelineBottomCoupler(stack_one, stack_two)
    print(coupler)
    assert_loopback_below(coupler.pipeline_one, (1, 2, 3))
    assert_loopback_below(coupler.pipeline_one, {
        'hello': 'world',
        'foo': 'bar'
    })
    assert_loopback_below(coupler.pipeline_one, (0, 1, 2, True, None, (3, 4), {
        'foo': 'bar'
    }))
    assert_loopback_below(coupler.pipeline_one, 12345)
Ejemplo n.º 4
0
def test_minimal_loopback_coupler(logical_substack_factory):
    """Test for correct echo from send to receive."""
    print('Testing document loopback with PipelineBottomCoupler...')
    stack_one = make_stack(transport_stack=make_transport(
        logical_substack=logical_substack_factory()),
                           application_stack=make_minimal(),
                           name=' Protocol')
    stack_two = AutomaticStack(
        make_stack(transport_stack=make_transport(
            logical_substack=logical_substack_factory()),
                   application_stack=make_minimal()), TopLoopbackLink())
    coupler = PipelineBottomCoupler(stack_one, stack_two)
    print(coupler)
    assert_loopback_below(coupler.pipeline_one, (1, 2, 3))
    assert_loopback_below(coupler.pipeline_one, {
        'hello': 'world',
        'foo': 'bar'
    })
    assert_loopback_below(coupler.pipeline_one, (0, 1, 2, True, None, (3, 4), {
        'foo': 'bar'
    }))
    assert_loopback_below(coupler.pipeline_one, 12345)