refactor(adminui): omit error key on success cert-audit rows + assert OccurredAtUtc (review)
This commit is contained in:
@@ -26,6 +26,7 @@ public sealed class CertAuditEventsTests
|
||||
evt.Actor.ShouldBe("alice");
|
||||
evt.Outcome.ShouldBe(AuditOutcome.Success);
|
||||
evt.EventId.ShouldNotBe(Guid.Empty);
|
||||
evt.OccurredAtUtc.ShouldBeGreaterThan(DateTimeOffset.UtcNow.AddSeconds(-5));
|
||||
evt.DetailsJson.ShouldNotBeNull();
|
||||
evt.DetailsJson!.ShouldContain(Thumb);
|
||||
}
|
||||
@@ -88,13 +89,14 @@ public sealed class CertAuditEventsTests
|
||||
evt.DetailsJson!.ShouldContain("store write failed");
|
||||
}
|
||||
|
||||
/// <summary>On success the error text is omitted from the details payload (it serializes null).</summary>
|
||||
/// <summary>On success the error text AND the error key are omitted from the details payload.</summary>
|
||||
[Fact]
|
||||
public void Build_success_omits_error_text()
|
||||
{
|
||||
var evt = CertAuditEvents.Build("Trust", "rejected", Thumb, "alice", success: true, error: "ignored");
|
||||
|
||||
evt.DetailsJson!.ShouldNotContain("ignored");
|
||||
evt.DetailsJson!.ShouldNotContain("error");
|
||||
}
|
||||
|
||||
/// <summary>The public Category constant matches the value stamped onto built events.</summary>
|
||||
|
||||
Reference in New Issue
Block a user