save progress

This commit is contained in:
master
2026-01-09 18:27:36 +02:00
parent e608752924
commit a21d3dbc1f
361 changed files with 63068 additions and 1192 deletions

View File

@@ -1,11 +1,31 @@
using System;
using System.Net.Http;
using System.Net.Http.Headers;
namespace StellaOps.Scanner.WebService.Tests;
public sealed class ScannerApplicationFixture : IDisposable
{
private ScannerApplicationFactory? _authenticatedFactory;
public ScannerApplicationFactory Factory { get; } = new();
public void Dispose() => Factory.Dispose();
/// <summary>
/// Creates an HTTP client with test authentication enabled.
/// </summary>
public HttpClient CreateAuthenticatedClient()
{
_authenticatedFactory ??= Factory.WithOverrides(useTestAuthentication: true);
var client = _authenticatedFactory.CreateClient();
// Add a valid test bearer token (must have at least 3 dot-separated segments per TestAuthenticationHandler)
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "test.valid.token");
return client;
}
public void Dispose()
{
_authenticatedFactory?.Dispose();
Factory.Dispose();
}
}