def test_deidentify_content(self): # Setup Expected Response expected_response = {} expected_response = dlp_pb2.DeidentifyContentResponse( **expected_response) # Mock the API response channel = ChannelStub(responses=[expected_response]) client = dlp_v2.DlpServiceClient(channel=channel) # Setup Request parent = client.project_path('[PROJECT]') response = client.deidentify_content(parent) assert expected_response == response assert len(channel.requests) == 1 expected_request = dlp_pb2.DeidentifyContentRequest(parent=parent) actual_request = channel.requests[0][1] assert expected_request == actual_request
def test_deidentify_content(self): # Setup Expected Response expected_response = {} expected_response = dlp_pb2.DeidentifyContentResponse(**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 = dlp_v2.DlpServiceClient() # Setup Request parent = client.project_path("[PROJECT]") response = client.deidentify_content(parent) assert expected_response == response assert len(channel.requests) == 1 expected_request = dlp_pb2.DeidentifyContentRequest(parent=parent) actual_request = channel.requests[0][1] assert expected_request == actual_request