def test_constructor(self): from google.cloud.trace_v1.gapic import trace_service_client channel = grpc_helpers.ChannelStub() gapic_client = trace_service_client.TraceServiceClient(channel=channel) _, api = self._make_one(gapic_client, mock.sentinel.client) self.assertIs(api._gapic_api, gapic_client) self.assertIs(api.client, mock.sentinel.client)
def _make_one(self, gapic_client=None, handwritten_client=None): from google.cloud.trace_v1.gapic import trace_service_client channel = grpc_helpers.ChannelStub() if gapic_client is None: gapic_client = trace_service_client.TraceServiceClient( channel=channel) if handwritten_client is None: handwritten_client = mock.Mock() api = self._get_target_class()(gapic_client, handwritten_client) return channel, api
def make_gax_trace_api(client): """Create an instance of the GAX Trace API. :type client: :class:`~google.cloud.trace.client.Client` :param client: The client that holds configuration details. :rtype: :class:`~google.cloud.trace._gax._TraceAPI` :returns: A Trace API instance with the proper configurations. """ generated = trace_service_client.TraceServiceClient() return _TraceAPI(generated, client)
def make_trace_api(client): """ Create an instance of the gapic Trace API. Args: client (~google.cloud.trace.client.Client): The client that holds configuration details. Returns: A :class:`~google.cloud.trace._gapic._TraceAPI` instance with the proper configurations. """ generated = trace_service_client.TraceServiceClient() return _TraceAPI(generated, client)