35 lines
1.1 KiB
C#
35 lines
1.1 KiB
C#
using TarninaHub.Application.Security;
|
|
using TarninaHub.Infrastructure.Auth;
|
|
|
|
namespace TarninaHub.Tests.Auth;
|
|
|
|
public class SecurityConstantsTests
|
|
{
|
|
[Theory]
|
|
[InlineData("user", true)]
|
|
[InlineData("jst", true)]
|
|
[InlineData("operator", true)]
|
|
[InlineData("manager", true)]
|
|
[InlineData("admin", true)]
|
|
[InlineData("guest", false)]
|
|
public void RoleNames_IsValid_RecognizesKnownRoles(string role, bool expected)
|
|
{
|
|
Assert.Equal(expected, RoleNames.IsValid(role));
|
|
}
|
|
|
|
[Fact]
|
|
public void AuthSettings_HasUsableSigningKey_RequiresAtLeast32Chars()
|
|
{
|
|
Assert.False(new AuthSettings { SigningKey = "short" }.HasUsableSigningKey);
|
|
Assert.True(new AuthSettings { SigningKey = new string('k', 32) }.HasUsableSigningKey);
|
|
}
|
|
|
|
[Fact]
|
|
public void ConsentScopes_ContainsExpectedLevels()
|
|
{
|
|
Assert.Contains(ConsentScopes.ByConsent, ConsentScopes.All);
|
|
Assert.Contains(ConsentScopes.Temporary, ConsentScopes.All);
|
|
Assert.Contains(ConsentScopes.Anonymized, ConsentScopes.All);
|
|
}
|
|
}
|