blockers 2

This commit is contained in:
StellaOps Bot
2025-11-23 16:57:18 +02:00
parent cce96f3596
commit 7768555f2d
17 changed files with 220 additions and 69 deletions

View File

@@ -0,0 +1,36 @@
using System.Net;
using System.Net.Http.Headers;
using FluentAssertions;
using Microsoft.AspNetCore.Mvc.Testing;
using Xunit;
namespace StellaOps.Concelier.WebService.Tests;
public class ConcelierTimelineCursorTests : IClassFixture<WebApplicationFactory<Program>>
{
private readonly WebApplicationFactory<Program> _factory;
public ConcelierTimelineCursorTests(WebApplicationFactory<Program> factory)
{
_factory = factory.WithWebHostBuilder(_ => { });
}
[Fact]
public async Task Timeline_respects_cursor_and_limit()
{
var client = _factory.CreateClient();
client.DefaultRequestHeaders.Add("X-Stella-Tenant", "tenant-a");
using var request = new HttpRequestMessage(HttpMethod.Get, "/obs/concelier/timeline?cursor=5&limit=2");
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("text/event-stream"));
var response = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead);
response.EnsureSuccessStatusCode();
response.Headers.TryGetValues("X-Next-Cursor", out var nextCursor).Should().BeTrue();
nextCursor!.Single().Should().Be("7");
var body = await response.Content.ReadAsStringAsync();
body.Should().Contain("id: 5");
body.Should().Contain("id: 6");
}
}