def test_get_trace(self):
        # Setup Expected Response
        project_id_2 = 'projectId2939242356'
        trace_id_2 = 'traceId2987826376'
        expected_response = {
            'project_id': project_id_2,
            'trace_id': trace_id_2
        }
        expected_response = trace_pb2.Trace(**expected_response)

        # Mock the API response
        channel = ChannelStub(responses=[expected_response])
        client = trace_v1.TraceServiceClient(channel=channel)

        # Setup Request
        project_id = 'projectId-1969970175'
        trace_id = 'traceId1270300245'

        response = client.get_trace(project_id, trace_id)
        assert expected_response == response

        assert len(channel.requests) == 1
        expected_request = trace_pb2.GetTraceRequest(project_id=project_id,
                                                     trace_id=trace_id)
        actual_request = channel.requests[0][1]
        assert expected_request == actual_request
    def test_get_trace(self):
        # Setup Expected Response
        project_id_2 = "projectId2939242356"
        trace_id_2 = "traceId2987826376"
        expected_response = {
            "project_id": project_id_2,
            "trace_id": trace_id_2
        }
        expected_response = trace_pb2.Trace(**expected_response)

        # Mock the API response
        channel = ChannelStub(responses=[expected_response])
        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
        with patch as create_channel:
            create_channel.return_value = channel
            client = trace_v1.TraceServiceClient()

        # Setup Request
        project_id = "projectId-1969970175"
        trace_id = "traceId1270300245"

        response = client.get_trace(project_id, trace_id)
        assert expected_response == response

        assert len(channel.requests) == 1
        expected_request = trace_pb2.GetTraceRequest(project_id=project_id,
                                                     trace_id=trace_id)
        actual_request = channel.requests[0][1]
        assert expected_request == actual_request