Deliver portable native Architecture B deployment and final verification

This commit is contained in:
Steffen committed 2026-10-14 16:32:20 +02:00
1 parent f451b55de1
commit 36740d2492
92 files changed
+10939 -926

No files matched your search

@@ -7,24 +7,25 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Xunit;
namespace HealthApp.AcceptanceTests;
public sealed class FoundationTests
{
[Fact]
public async Task Framework_login_retains_identity_generic_failures_and_no_service_key_bypass()
{
var auth=new AuthenticatedTestClient();
using var host=new WebApplicationFactory<Program>().WithWebHostBuilder(b=>b.UseEnvironment("Development").ConfigureAppConfiguration((_,c)=>c.AddInMemoryCollection(auth.Configuration())));
using var client=host.CreateClient();
using var login=await client.PostAsJsonAsync("/api/authentication/login",new {accountId="professional",password=AuthenticatedTestClient.Password});
Assert.Equal(HttpStatusCode.OK,login.StatusCode);Assert.Equal("no-store",login.Headers.CacheControl!.ToString());
using var json=JsonDocument.Parse(await login.Content.ReadAsStringAsync());
Assert.Equal("HealthcareProfessional",json.RootElement.GetProperty("role").GetString());
Assert.Equal(1800,json.RootElement.GetProperty("expiresIn").GetInt32());
Assert.DoesNotContain("patientId",json.RootElement.GetRawText());
using var badAccount=await client.PostAsJsonAsync("/api/authentication/login",new {accountId="missing",password=AuthenticatedTestClient.Password});
using var badPassword=await client.PostAsJsonAsync("/api/authentication/login",new {accountId="test-0",password="wrong"});
Assert.Equal(HttpStatusCode.Unauthorized,badAccount.StatusCode);Assert.Equal(await badAccount.Content.ReadAsStringAsync(),await badPassword.Content.ReadAsStringAsync());
using var forged=new HttpRequestMessage(HttpMethod.Get,"/api/professionals/me/patients");forged.Headers.Add("X-Service-Key",auth.OverviewServiceKey);
using var rejected=await client.SendAsync(forged);Assert.Equal(HttpStatusCode.Unauthorized,rejected.StatusCode);
}
[Fact]
public async Task Framework_login_retains_identity_generic_failures_and_no_service_key_bypass()
{
var auth = new AuthenticatedTestClient();
using var host = new WebApplicationFactory<Program>().WithWebHostBuilder(b => b.UseEnvironment("Development").ConfigureAppConfiguration((_, c) => c.AddInMemoryCollection(auth.Configuration())));
using var client = host.CreateClient();
using var login = await client.PostAsJsonAsync("/api/authentication/login", new { accountId = "professional", password = AuthenticatedTestClient.Password });
Assert.Equal(HttpStatusCode.OK, login.StatusCode); Assert.Equal("no-store", login.Headers.CacheControl!.ToString());
using var json = JsonDocument.Parse(await login.Content.ReadAsStringAsync());
Assert.Equal("HealthcareProfessional", json.RootElement.GetProperty("role").GetString());
Assert.Equal(1800, json.RootElement.GetProperty("expiresIn").GetInt32());
Assert.DoesNotContain("patientId", json.RootElement.GetRawText());
using var badAccount = await client.PostAsJsonAsync("/api/authentication/login", new { accountId = "missing", password = AuthenticatedTestClient.Password });
using var badPassword = await client.PostAsJsonAsync("/api/authentication/login", new { accountId = "test-0", password = "wrong" });
Assert.Equal(HttpStatusCode.Unauthorized, badAccount.StatusCode); Assert.Equal(await badAccount.Content.ReadAsStringAsync(), await badPassword.Content.ReadAsStringAsync());
using var forged = new HttpRequestMessage(HttpMethod.Get, "/api/professionals/me/patients"); forged.Headers.Add("X-Service-Key", auth.OverviewServiceKey);
using var rejected = await client.SendAsync(forged); Assert.Equal(HttpStatusCode.Unauthorized, rejected.StatusCode);
}
}