Exemple #1
0
def test_image_annotator_grpc_asyncio_transport_channel():
    channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials())

    # Check that channel is used if provided.
    transport = transports.ImageAnnotatorGrpcAsyncIOTransport(
        host="squid.clam.whelk", channel=channel,
    )
    assert transport.grpc_channel == channel
    assert transport._host == "squid.clam.whelk:443"
    assert transport._ssl_channel_credentials == None
def test_transport_get_channel():
    # A client may be instantiated with a custom transport instance.
    transport = transports.ImageAnnotatorGrpcTransport(
        credentials=credentials.AnonymousCredentials(), )
    channel = transport.grpc_channel
    assert channel

    transport = transports.ImageAnnotatorGrpcAsyncIOTransport(
        credentials=credentials.AnonymousCredentials(), )
    channel = transport.grpc_channel
    assert channel