def test_transport_instance(): # A client may be instantiated with a custom transport instance. transport = transports.MessagingGrpcTransport( credentials=credentials.AnonymousCredentials(), ) client = MessagingClient(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.MessagingGrpcTransport( credentials=credentials.AnonymousCredentials(), ) with pytest.raises(ValueError): client = MessagingClient( credentials=credentials.AnonymousCredentials(), transport=transport, )
def test_messaging_grpc_transport_channel(): channel = grpc.insecure_channel('http://localhost/') transport = transports.MessagingGrpcTransport( channel=channel, ) assert transport.grpc_channel is channel