* fix SA1505 and SA1508 * fix SA1116 * fix SA1009 * fix SA1019 * fix SA1127 * fix SA1128 * fix SA1134 * fix indent * allow CA2227 * fix CA1810 * using clean up * fix naming * fix CA1806 * fix await * Revert "fix CA1806" This reverts commit a3b465087fdaf26ec461272373ee9810a90de2cc. * fix dotnet format * allow SA1009
30 lines
1.0 KiB
C#
30 lines
1.0 KiB
C#
using System;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using FluentAssertions;
|
|
using k8s.Authentication;
|
|
|
|
namespace k8s.Tests
|
|
{
|
|
public class TokenFileAuthTests
|
|
{
|
|
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;
|
|
result = await auth.GetAuthenticationHeaderAsync(CancellationToken.None).ConfigureAwait(false);
|
|
result.Scheme.Should().Be("Bearer");
|
|
result.Parameter.Should().Be("token2");
|
|
}
|
|
}
|
|
}
|