tests: add mucho tests
This commit is contained in:
@@ -16,6 +16,8 @@ public class TestApi : WebApplicationFactory<Program>
|
||||
}));
|
||||
|
||||
c.AddSingleton(Options.Create(JwtTokenBuilder.DefaultJwtOptions));
|
||||
|
||||
c.AddSingleton<IKeyRing>(TestKeyRing.From);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
namespace FiscalOS.API.Tests.Infra;
|
||||
|
||||
internal sealed class TestKeyRing : IKeyRing
|
||||
{
|
||||
private readonly string _key = Convert.ToBase64String(RandomNumberGenerator.GetBytes(32));
|
||||
|
||||
private TestKeyRing()
|
||||
{
|
||||
}
|
||||
|
||||
public static TestKeyRing From(IServiceProvider serviceProvider)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
|
||||
public KeyRingEntry GetKey(string keyId)
|
||||
{
|
||||
return KeyRingEntry.From(keyId, _key);
|
||||
}
|
||||
|
||||
public KeyRingEntry GetPrimaryKey()
|
||||
{
|
||||
return KeyRingEntry.From("primary-key-id", _key);
|
||||
}
|
||||
|
||||
public Task<KeyRingEntry> SaveKeyAsync(string key)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user