Files
csharp/tests/KubernetesClient.Tests/GcpTokenProviderTests.cs
Manuel Menegazzo f615b5b459 Fix some compilation warnings (#1010)
* Fixe some summary warning

* Fixed more warning

* Uniformed example projects code

* Uniformed test projects code

* Fix OperatingSystems enum and GenericType summaries
2022-09-15 16:21:21 -07:00

29 lines
960 B
C#

using FluentAssertions;
using k8s.Authentication;
using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace k8s.Tests
{
public class GcpTokenProviderTests
{
[OperatingSystemDependentFact(Exclude = OperatingSystems.OSX)]
public async Task GetToken()
{
var isWindows = Environment.OSVersion.Platform == PlatformID.Win32NT;
var cmd = Path.Combine(Directory.GetCurrentDirectory(), "assets", isWindows ? "mock-gcloud.cmd" : "mock-gcloud.sh");
if (!isWindows)
{
System.Diagnostics.Process.Start("chmod", $"+x {cmd}").WaitForExit();
}
var sut = new GcpTokenProvider(cmd);
var result = await sut.GetAuthenticationHeaderAsync(CancellationToken.None).ConfigureAwait(false);
result.Scheme.Should().Be("Bearer");
result.Parameter.Should().Be("ACCESS-TOKEN");
}
}
}