Setup-pagina verschijnt niet meer als de setup-status niet te lezen is

De route-guard las elke fout (429, 500, 503, 404) als 'niet geinitialiseerd' en stuurde naar de
setup-pagina. Nu geen gok: bij een onleesbare status geen doorverwijzing. De statuslezing valt onder de
ruimere limiter in plaats van de strikte login-limiter (die 5 per minuut deelt met echte inlogpogingen).
De loginpagina meldt als het CMS uitgeschakeld of in onderhoud is.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-09 08:53:37 +01:00
co-authored by Claude Sonnet 5.5
parent 701091f179
commit ff94719455
9 changed files with 188 additions and 4 deletions
@@ -0,0 +1,26 @@
using System.Reflection;
using FluentAssertions;
using Microsoft.AspNetCore.RateLimiting;
using SlpModularCms.Modules.Identity.Controllers;
namespace SlpModularCms.Modules.Identity.Tests.Controllers;
public class SetupRateLimitTests
{
private static string? PolicyOf(string method) =>
typeof(SetupController).GetMethod(method)!.GetCustomAttribute<EnableRateLimitingAttribute>()?.PolicyName;
[Fact]
public void TheStatusRead_IsNotUnderTheStrictLoginLimiter()
{
// The admin reads it on every page load. Under the login limiter (5 a minute, shared with real login
// attempts) a few reloads used it up and the 429 that followed was read as "not set up".
PolicyOf(nameof(SetupController.GetStatus)).Should().Be("refresh");
}
[Fact]
public void CreatingTheOwner_StaysUnderTheStrictLoginLimiter()
{
PolicyOf(nameof(SetupController.CreateOwner)).Should().Be("login");
}
}