Deliver portable native Architecture B deployment and final verification
This commit is contained in:
1 parent
f451b55de1
commit
36740d2492
92 files changed
+10939
-926
No files matched your search
@@ -239,16 +239,16 @@ public sealed class PatientAuthenticationTests(ObservationApiFixture fixture) :
|
||||
{
|
||||
var patient = await Patient();
|
||||
using var request = new HttpRequestMessage(HttpMethod.Get, $"/api/patients/{patient.PatientId}");
|
||||
request.Headers.Authorization=new("Bearer",patient.Token);request.Headers.Add("X-Gateway-Key","forged");
|
||||
using var own=await fixture.RawClient.SendAsync(request);Assert.Equal(HttpStatusCode.OK,own.StatusCode);
|
||||
using var bypass=new HttpRequestMessage(HttpMethod.Get,"/api/patients/by-account/"+patient.Account);
|
||||
bypass.Headers.Authorization=new("Bearer",patient.Token);
|
||||
using var absent=await fixture.RawClient.SendAsync(bypass);Assert.Equal(HttpStatusCode.NotFound,absent.StatusCode);
|
||||
foreach(var path in new[]{"/api/patients","/api/patients/by-account/test-0"})
|
||||
request.Headers.Authorization = new("Bearer", patient.Token); request.Headers.Add("X-Gateway-Key", "forged");
|
||||
using var own = await fixture.RawClient.SendAsync(request); Assert.Equal(HttpStatusCode.OK, own.StatusCode);
|
||||
using var bypass = new HttpRequestMessage(HttpMethod.Get, "/api/patients/by-account/" + patient.Account);
|
||||
bypass.Headers.Authorization = new("Bearer", patient.Token);
|
||||
using var absent = await fixture.RawClient.SendAsync(bypass); Assert.Equal(HttpStatusCode.NotFound, absent.StatusCode);
|
||||
foreach (var path in new[] { "/api/patients", "/api/patients/by-account/test-0" })
|
||||
{
|
||||
using var forged=new HttpRequestMessage(path=="/api/patients"?HttpMethod.Post:HttpMethod.Get,path){Content=path=="/api/patients"?JsonContent.Create(ProfileRequest):null};
|
||||
forged.Headers.Add("X-Service-Key",fixture.Authentication.ObservationServiceKey);
|
||||
using var denied=await fixture.RawClient.SendAsync(forged);Assert.Equal(HttpStatusCode.Unauthorized,denied.StatusCode);
|
||||
using var forged = new HttpRequestMessage(path == "/api/patients" ? HttpMethod.Post : HttpMethod.Get, path) { Content = path == "/api/patients" ? JsonContent.Create(ProfileRequest) : null };
|
||||
forged.Headers.Add("X-Service-Key", fixture.Authentication.ObservationServiceKey);
|
||||
using var denied = await fixture.RawClient.SendAsync(forged); Assert.Equal(HttpStatusCode.Unauthorized, denied.StatusCode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user