Merge branch 'review/wp5' into review/integration
This commit is contained in:
@@ -179,6 +179,56 @@ public class NotificationReportPageTests : BunitContext
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Code review 2026-12-02 UI-11: a parked row whose source site no longer resolves (site
|
||||
/// deleted or renamed) stays visible; a system-wide user can Retry it, while a site-scoped
|
||||
/// user is still refused (there is no Site.Id to authorize against).
|
||||
/// </summary>
|
||||
/// <param name="siteScoped">Whether the caller carries a SiteId claim (site-scoped Deployer).</param>
|
||||
[Theory]
|
||||
[InlineData(false)]
|
||||
[InlineData(true)]
|
||||
public void Retry_OnRowFromADeletedSite_AllowedSystemWide_DeniedScoped(bool siteScoped)
|
||||
{
|
||||
_queryReply = _queryReply with
|
||||
{
|
||||
Notifications = new List<NotificationSummary>
|
||||
{
|
||||
new("notif-cccccccc-3333", "Email", "Ops On-Call", "Orphaned alert",
|
||||
"Parked", RetryCount: 5, LastError: "SMTP timeout", SourceSiteId: "deleted-site",
|
||||
SourceInstanceId: "Pump-009", CreatedAt: DateTimeOffset.UtcNow.AddMinutes(-30),
|
||||
DeliveredAt: null, IsStuck: false),
|
||||
},
|
||||
TotalCount = 1,
|
||||
};
|
||||
if (siteScoped)
|
||||
{
|
||||
var claims = new[]
|
||||
{
|
||||
new Claim(JwtTokenService.UsernameClaimType, "tester"),
|
||||
new Claim(JwtTokenService.RoleClaimType, "Deployer"),
|
||||
new Claim(JwtTokenService.SiteIdClaimType, "1"),
|
||||
};
|
||||
Services.AddSingleton<AuthenticationStateProvider>(
|
||||
new TestAuthStateProvider(new ClaimsPrincipal(new ClaimsIdentity(claims, "TestAuth"))));
|
||||
}
|
||||
|
||||
var cut = Render<NotificationReportPage>();
|
||||
cut.WaitForState(() => cut.Markup.Contains("Orphaned alert"));
|
||||
cut.FindAll("tbody tr").First(r => r.TextContent.Contains("Orphaned alert"))
|
||||
.QuerySelectorAll("button").First(b => b.TextContent.Contains("Retry")).Click();
|
||||
|
||||
if (siteScoped)
|
||||
{
|
||||
cut.WaitForAssertion(() => Assert.Contains("not permitted to act on notifications", cut.Markup));
|
||||
Assert.Empty(_retryRequests);
|
||||
}
|
||||
else
|
||||
{
|
||||
cut.WaitForAssertion(() => Assert.Equal("notif-cccccccc-3333", Assert.Single(_retryRequests).NotificationId));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Verifies that a query failure shows an error message.</summary>
|
||||
[Fact]
|
||||
public void QueryFailure_ShowsErrorMessage()
|
||||
|
||||
Reference in New Issue
Block a user