def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.TestingGrpcTransport( credentials=credentials.AnonymousCredentials(), ) client = TestingClient(transport=transport) assert client._transport is transport
def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.TestingGrpcTransport( credentials=credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = TestingClient( credentials=credentials.AnonymousCredentials(), transport=transport, )
def test_testing_grpc_transport_channel(): channel = grpc.insecure_channel('http://localhost/') transport = transports.TestingGrpcTransport(channel=channel, ) assert transport.grpc_channel is channel