Example #1
0
def test_image_annotator_grpc_asyncio_transport_channel():
    channel = aio.insecure_channel("http://localhost/")

    # 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"
Example #2
0
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