feature: RBAC + Clinical Audit Logging
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc.Testing;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@@ -29,6 +30,17 @@ public class ApiFixture : WebApplicationFactory<Program>, IAsyncLifetime
|
||||
|
||||
config.AddJsonFile("appsettings.Testing.json", optional: true, reloadOnChange: false);
|
||||
});
|
||||
|
||||
builder.ConfigureServices(services =>
|
||||
{
|
||||
services.AddAuthentication(options =>
|
||||
{
|
||||
options.DefaultAuthenticateScheme = TestingAuthHandler.SchemeName;
|
||||
options.DefaultChallengeScheme = TestingAuthHandler.SchemeName;
|
||||
})
|
||||
.AddScheme<AuthenticationSchemeOptions, TestingAuthHandler>(
|
||||
TestingAuthHandler.SchemeName, _ => { });
|
||||
});
|
||||
}
|
||||
|
||||
public async Task InitializeAsync()
|
||||
@@ -52,6 +64,12 @@ public class ApiFixture : WebApplicationFactory<Program>, IAsyncLifetime
|
||||
await server.FlushDatabaseAsync(1);
|
||||
}
|
||||
|
||||
protected override void ConfigureClient(HttpClient client)
|
||||
{
|
||||
base.ConfigureClient(client);
|
||||
client.DefaultRequestHeaders.Add("X-Test-Role", "ADMIN");
|
||||
}
|
||||
|
||||
public new async Task DisposeAsync()
|
||||
{
|
||||
await base.DisposeAsync();
|
||||
|
||||
Reference in New Issue
Block a user