Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ public void Translate()
// We sometimes get:
// Le temps froid sera bientôt fini
// Le froid sera bientôt terminé
Assert.Contains("froid sera bientôt", response.Translations[0].TranslatedText);
// Le froid va bientôt disparaître
Assert.Contains("froid", response.Translations[0].TranslatedText);
Comment thread
amanda-tarafa marked this conversation as resolved.
}

[Fact]
Expand All @@ -69,7 +70,8 @@ public void TranslateList()
// We sometimes get:
// Le temps froid sera bientôt fini
// Le froid sera bientôt terminé
Assert.Contains("froid sera bientôt", response.Translations[0].TranslatedText);
// Le froid va bientôt disparaître
Assert.Contains("froid", response.Translations[0].TranslatedText);
Comment thread
amanda-tarafa marked this conversation as resolved.
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

<ItemGroup>
<Compile Include="..\..\Generated\Google.Apis.BigtableAdmin.v2\Google.Apis.BigtableAdmin.v2.cs" Link="Utils\Google.Apis.BigtableAdmin.v2.cs" />
<Compile Include="..\..\Generated\Google.Apis.CloudMachineLearningEngine.v1\Google.Apis.CloudMachineLearningEngine.v1.cs" Link="Utils\Google.Apis.CloudMachineLearningEngine.v1.cs" />
<Compile Include="..\..\Generated\Google.Apis.IAMCredentials.v1\Google.Apis.IAMCredentials.v1.cs" Link="Utils\Google.Apis.IAMCredentials.v1.cs" />
<Compile Include="..\..\Generated\Google.Apis.Storage.v1\Google.Apis.Storage.v1.cs" Link="Utils\Google.Apis.Storage.v1.cs" />
</ItemGroup>
Expand Down
48 changes: 30 additions & 18 deletions Src/Support/Google.Apis.IntegrationTests/RestPathTests.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
using Google;
using Google.Apis.CloudMachineLearningEngine.v1;
using Google.Apis.CloudMachineLearningEngine.v1.Data;
/*
Copyright 2026 Google Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

using Google;
using Google.Apis.BigtableAdmin.v2;
using Google.Apis.BigtableAdmin.v2.Data;
using Google.Apis.Services;
using IntegrationTests.Utils;
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Text;
using Xunit;

namespace IntegrationTests
Expand All @@ -20,21 +32,21 @@ public void ColonCorrectness()
// This is fine, as the test is checking that the request URI is correctly formed,
// not that the call itself works.
// The check on the returned error ensures that the URI is correct.
// The "predict" method contains a ':' in the request path, which is what this test is testing.
var client = new CloudMachineLearningEngineService(new BaseClientService.Initializer
// The "GetIamPolicy" method contains a ':' in the request path, which is what this test is testing.
var client = new BigtableAdminService(new BaseClientService.Initializer
{
HttpClientInitializer = Helper.GetServiceCredential()
.CreateScoped(CloudMachineLearningEngineService.Scope.CloudPlatform),
ApplicationName = "IntegrationTest"
.CreateScoped(BigtableAdminService.Scope.CloudPlatform),
ApplicationName = "IntegrationTest",
});
var emptyBody = new GoogleCloudMlV1PredictRequest { HttpBody = new GoogleApiHttpBody() };
var request = client.Projects.Predict(emptyBody, "projects/dummyProject");
request.ModifyRequest = httpRequestMessage =>
{
httpRequestMessage.Content = new StringContent("dummyRequest", Encoding.UTF8, "application/json");
};
var request = client.Projects.Instances.GetIamPolicy(
new GetIamPolicyRequest
{
Options = new GetPolicyOptions { RequestedPolicyVersion = 3 }
},
$"projects/{Helper.GetProjectId()}/instances/fake-instance");
var ex = Assert.Throws<GoogleApiException>(() => request.Execute());
Assert.Contains("Permission denied on resource project dummyProject", ex.Message);
Assert.Contains("HttpStatusCode is NotFound.", ex.Message);
}
}
}
2 changes: 1 addition & 1 deletion Src/Support/Google.Apis/Services/BaseClientService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public class Initializer
public Initializer()
{
GZipEnabled = true;
Serializer = new NewtonsoftJsonSerializer();
Serializer = NewtonsoftJsonSerializer.Instance;
DefaultExponentialBackOffPolicy = ExponentialBackOffPolicy.UnsuccessfulResponse503;
MaxUrlLength = DefaultMaxUrlLength;
VersionHeaderBuilder = new VersionHeaderBuilder()
Expand Down
Loading