コード例 #1
0
ファイル: test_remote.py プロジェクト: hydface2/mcloud
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()
コード例 #2
0
ファイル: test_remote.py プロジェクト: hydface2/mcloud
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()
コード例 #3
0
ファイル: test_remote.py プロジェクト: hydface2/mcloud
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()
コード例 #4
0
ファイル: test_remote.py プロジェクト: hydface2/mcloud
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()