* Fixe some summary warning * Fixed more warning * Uniformed example projects code * Uniformed test projects code * Fix OperatingSystems enum and GenericType summaries
29 lines
960 B
C#
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");
|
|
}
|
|
}
|
|
}
|