* Fixe some summary warning * Fixed more warning * Uniformed example projects code * Uniformed test projects code * Fix OperatingSystems enum and GenericType summaries
32 lines
1.1 KiB
C#
32 lines
1.1 KiB
C#
using FluentAssertions;
|
|
using k8s.Authentication;
|
|
using System;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using Xunit;
|
|
|
|
namespace k8s.Tests
|
|
{
|
|
public class TokenFileAuthTests
|
|
{
|
|
[Fact]
|
|
public async Task TestToken()
|
|
{
|
|
var auth = new TokenFileAuth("assets/token1");
|
|
var result = await auth.GetAuthenticationHeaderAsync(CancellationToken.None).ConfigureAwait(false);
|
|
result.Scheme.Should().Be("Bearer");
|
|
result.Parameter.Should().Be("token1");
|
|
|
|
auth.TokenFile = "assets/token2";
|
|
result = await auth.GetAuthenticationHeaderAsync(CancellationToken.None).ConfigureAwait(false);
|
|
result.Scheme.Should().Be("Bearer");
|
|
result.Parameter.Should().Be("token1");
|
|
|
|
auth.TokenExpiresAt = DateTime.UtcNow.AddSeconds(-1);
|
|
result = await auth.GetAuthenticationHeaderAsync(CancellationToken.None).ConfigureAwait(false);
|
|
result.Scheme.Should().Be("Bearer");
|
|
result.Parameter.Should().Be("token2");
|
|
}
|
|
}
|
|
}
|