Ejemplo n.º 1
0
def test_request_response():
    #-----------------------------------
    # preparations
    #-----------------------------------

    # cleanup a bit
    inject.clear()

    def my_config(binder):
        binder.bind('settings', None)

    inject.configure(my_config)

    # log.startLogging(sys.stdout)

    server = Server(port=9998, no_ssl=True)
    server.bind()

    client = Client(port=9998, no_ssl=True)
    yield client.connect()

    response = yield client.call_sync('ping')

    assert response == 'pong'

    client.shutdown()
    server.shutdown()
Ejemplo n.º 2
0
def test_request_response():
    #-----------------------------------
    # preparations
    #-----------------------------------

    # cleanup a bit
    inject.clear()

    def my_config(binder):
        binder.bind('settings', None)
    inject.configure(my_config)


    # log.startLogging(sys.stdout)

    server = Server(port=9998, no_ssl=True)
    server.bind()

    client = Client(port=9998, no_ssl=True)
    yield client.connect()

    response = yield client.call_sync('ping')

    assert response == 'pong'

    client.shutdown()
    server.shutdown()
Ejemplo n.º 3
0
def test_request_response_no_such_command():
    #-----------------------------------
    # preparations
    #-----------------------------------

    # cleanup a bit
    inject.clear()

    def my_config(binder):
        binder.bind('settings', None)

    inject.configure(my_config)

    log.startLogging(sys.stdout)

    server = Server(port=9996, no_ssl=True)
    server.bind()

    client = Client(port=9996, no_ssl=True)
    yield client.connect()

    with pytest.raises(ApiError):
        yield client.call_sync('hoho')

    client.shutdown()
    server.shutdown()
Ejemplo n.º 4
0
def test_request_response_no_such_command():
    #-----------------------------------
    # preparations
    #-----------------------------------

    # cleanup a bit
    inject.clear()

    def my_config(binder):
        binder.bind('settings', None)
    inject.configure(my_config)


    log.startLogging(sys.stdout)

    server = Server(port=9996, no_ssl=True)
    server.bind()

    client = Client(port=9996, no_ssl=True)
    yield client.connect()

    with pytest.raises(ApiError):
        yield client.call_sync('hoho')

    client.shutdown()
    server.shutdown()