コード例 #1
0
def test_client_withDEFAULT_CLIENT_INFO():
    client_info = gapic_v1.client_info.ClientInfo()

    with mock.patch.object(transports.CustomInterestServiceTransport,
                           '_prep_wrapped_messages') as prep:
        client = CustomInterestServiceClient(
            credentials=ga_credentials.AnonymousCredentials(),
            client_info=client_info,
        )
        prep.assert_called_once_with(client_info)

    with mock.patch.object(transports.CustomInterestServiceTransport,
                           '_prep_wrapped_messages') as prep:
        transport_class = CustomInterestServiceClient.get_transport_class()
        transport = transport_class(
            credentials=ga_credentials.AnonymousCredentials(),
            client_info=client_info,
        )
        prep.assert_called_once_with(client_info)
コード例 #2
0
def test_custom_interest_service_client_get_transport_class():
    transport = CustomInterestServiceClient.get_transport_class()
    assert transport == transports.CustomInterestServiceGrpcTransport

    transport = CustomInterestServiceClient.get_transport_class("grpc")
    assert transport == transports.CustomInterestServiceGrpcTransport