Publish curated Knowledge Hub source from 2ed833f290b439a7bc91e5fd19b042c269e3bee9

This commit is contained in:
Public Source Publisher committed 2026-10-03 17:07:21 +00:00
1 parent 10f2edcd29
commit 59f15b2d08
218 files changed
+23995 -1849

No files matched your search

@@ -1,13 +1,35 @@
using System.Net.Http.Json;
using ItWorx.KnowledgeHub.Application.Audit;
using ItWorx.KnowledgeHub.Contracts.Activity;
using ItWorx.KnowledgeHub.Contracts.Knowledge;
using ItWorx.KnowledgeHub.IntegrationTests.Infrastructure;
using Microsoft.Extensions.DependencyInjection;
namespace ItWorx.KnowledgeHub.IntegrationTests.Operations;
[Collection(PostgresTestGroup.Name)]
public sealed class ActivityFeedTests(PostgresContainerFixture postgres) : OwnerSetupTestBase(postgres)
{
[Fact]
public async Task Activity_excludes_security_events_before_pagination_and_audit_retains_them()
{
using var client = Factory.CreateClient();
await SetupHelper.LoginAsync(client, OwnerEmail, OwnerPassword);
(await SetupHelper.PostWithCsrfAsync(client, "/api/v1/pages",
new CreatePageRequest(null, "Operationeel resultaat", "WikiPage", "Inhoud.", null))).EnsureSuccessStatusCode();
using var scope = Factory.Services.CreateScope();
var audit = scope.ServiceProvider.GetRequiredService<IAuditEventRecorder>();
for (var i = 0; i < 3; i++)
await audit.RecordAsync(new AuditEventRecord(AuditActorKind.System, null, "security",
"token.rotated", "service-account", Guid.NewGuid().ToString(), "Beveiligingswijziging", null,
DateTimeOffset.UtcNow), CancellationToken.None);
var feed = await client.GetFromJsonAsync<ActivityListResponse>("/api/v1/activity?limit=1");
Assert.Single(feed!.Items);
Assert.Equal("page.created", feed.Items[0].Action);
var raw = await scope.ServiceProvider.GetRequiredService<IAuditEventReader>().ListRecentAsync(10, CancellationToken.None);
Assert.Equal(3, raw.Count(item => item.Action == "token.rotated"));
}
[Fact]
public async Task Activity_feed_returns_real_append_only_audit_events_in_reverse_chronological_order()
{