release/1.0.8-rc1 #42

Merged
notazof merged 47 commits from release/1.0.8-rc1 into main 2026-08-23 23:19:07 +01:00
Showing only changes of commit 4b9b8d5e78 - Show all commits

fixes the compile
Some checks failed
Dotnet build and test / build (pull_request) Has been cancelled

Paul Schneider 2026-08-21 20:25:13 +01:00
Signed by: notazof
GPG key ID: 1DD5D838E5343B06

View file

@ -1,5 +1,4 @@
using System.Net; using System.Net;
using System.Net.Http;
using System.Net.Http.Json; using System.Net.Http.Json;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Yavsc.Abstract.BlogSpot; using Yavsc.Abstract.BlogSpot;
@ -40,11 +39,17 @@ public sealed class BlogAclApiTests : IClassFixture<BlogsWebServerFixture>
{ {
private readonly BlogsWebServerFixture _fixture; private readonly BlogsWebServerFixture _fixture;
public long CircleId { get; private set; }
public long PostId { get; private set; }
public BlogAclApiTests(BlogsWebServerFixture fixture) public BlogAclApiTests(BlogsWebServerFixture fixture)
{ {
_fixture = fixture; _fixture = fixture;
ResetDatabaseWithAlice();
} }
/// <summary>Reset the in-memory database and seed <c>alice</c>. /// <summary>Reset the in-memory database and seed <c>alice</c>.
/// The shared SQLite <c>:memory:</c> store persists across /// The shared SQLite <c>:memory:</c> store persists across
/// requests, so each test starts from a clean slate.</summary> /// requests, so each test starts from a clean slate.</summary>
@ -65,6 +70,8 @@ public sealed class BlogAclApiTests : IClassFixture<BlogsWebServerFixture>
Avatar = "/avatars/alice.png", Avatar = "/avatars/alice.png",
}); });
db.SaveChanges(); db.SaveChanges();
CircleId = SeedCircle("alice", "test", isPublic: true);
PostId = SeedBlogPost("alice", "Billet ACL test");
} }
/// <summary>Create a circle owned by <paramref name="ownerId"/> /// <summary>Create a circle owned by <paramref name="ownerId"/>
@ -140,19 +147,17 @@ public sealed class BlogAclApiTests : IClassFixture<BlogsWebServerFixture>
[Fact] [Fact]
public async Task PostCircleAuthorization_returns_201_when_adding_existing_circle_to_existing_post() public async Task PostCircleAuthorization_returns_201_when_adding_existing_circle_to_existing_post()
{ {
ResetDatabaseWithAlice();
var circleId = SeedCircle("alice", "Famille");
var postId = SeedBlogPost("alice", "Billet de test");
using var http = NewClient("alice"); using var http = NewClient("alice");
// Mirror PostIt's payload: scalar FK ids only, no nav props. // Mirror PostIt's payload: scalar FK ids only, no nav props.
var payload = new CircleAuthorizationToBlogPost var payload = new CircleAuthorizationToBlogPost
{ {
CircleId = circleId, CircleId = CircleId,
BlogPostId = postId, BlogPostId = PostId,
}; };
var response = await http.PostAsJsonAsync(BlogAclUrl(), payload); var response = await http.PostAsJsonAsync(BlogAclUrl(), payload,
TestContext.Current.CancellationToken);
// Expected: 201 Created (per controller line 133: return // Expected: 201 Created (per controller line 133: return
// CreatedAtRoute("GetCircleAuthorizationToBlogPost", ...)). // CreatedAtRoute("GetCircleAuthorizationToBlogPost", ...)).
@ -179,7 +184,6 @@ public sealed class BlogAclApiTests : IClassFixture<BlogsWebServerFixture>
[Fact] [Fact]
public async Task PostCircleAuthorization_returns_201_when_payload_mirrors_PostIt_shape_against_existing_circle_named_test() public async Task PostCircleAuthorization_returns_201_when_payload_mirrors_PostIt_shape_against_existing_circle_named_test()
{ {
ResetDatabaseWithAlice();
// The prod circle already exists with Name="test", Public=true, // The prod circle already exists with Name="test", Public=true,
// owned by the caller. We seed the same shape pre-POST so the // owned by the caller. We seed the same shape pre-POST so the
// test reproduces the prod scenario end-to-end. // test reproduces the prod scenario end-to-end.
@ -194,7 +198,8 @@ public sealed class BlogAclApiTests : IClassFixture<BlogsWebServerFixture>
BlogPostId = postId BlogPostId = postId
}; };
var response = await http.PostAsJsonAsync(BlogAclUrl(), payload); var response = await http.PostAsJsonAsync(BlogAclUrl(), payload,
TestContext.Current.CancellationToken);
Assert.Equal(HttpStatusCode.Created, response.StatusCode); Assert.Equal(HttpStatusCode.Created, response.StatusCode);
} }
@ -210,22 +215,18 @@ public sealed class BlogAclApiTests : IClassFixture<BlogsWebServerFixture>
public static IEnumerable<PostAccessControlRulePayload?[]> BlogAclPayloadsForNever500() public static IEnumerable<PostAccessControlRulePayload?[]> BlogAclPayloadsForNever500()
{ {
var circleId = SeedCircle("alice", "test", isPublic: true);
var postId = SeedBlogPost("alice", "Billet ACL test");
// circleId only (the historical bug shape, 2026-08-21 mercure): // circleId only (the historical bug shape, 2026-08-21 mercure):
// must be rejected, never 500. // must be rejected, never 500.
yield return new PostAccessControlRulePayload?[] yield return new PostAccessControlRulePayload?[]
{ {
new PostAccessControlRulePayload new PostAccessControlRulePayload
{ {
BlogPostId = postId,
CircleId = circleId
}, },
new PostAccessControlRulePayload new PostAccessControlRulePayload
{ {
BlogPostId = -1, BlogPostId = -1,
CircleId = circleId CircleId = 1
} }
}; };