From 2063cb59fdb0aa3f373ac5538f89dc8cf3d3e6b4 Mon Sep 17 00:00:00 2001 From: xiong Date: Tue, 4 Aug 2026 09:46:44 +0800 Subject: [PATCH] test(security): invalidate data scope snapshots --- Tiku.IntegrationTests/Api/ContentManagementEndpointTests.cs | 6 +++++- Tiku.IntegrationTests/Api/TenantCommerceEndpointTests.cs | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Tiku.IntegrationTests/Api/ContentManagementEndpointTests.cs b/Tiku.IntegrationTests/Api/ContentManagementEndpointTests.cs index 71ee459..249acd9 100644 --- a/Tiku.IntegrationTests/Api/ContentManagementEndpointTests.cs +++ b/Tiku.IntegrationTests/Api/ContentManagementEndpointTests.cs @@ -3,6 +3,8 @@ using System.Net.Http.Json; using System.Text.Json; using Microsoft.Extensions.DependencyInjection; using Tiku.Api.Contracts; +using Tiku.Application.Auth; +using Tiku.Application.Security; using Tiku.Domain.Catalog; using Tiku.Domain.Common; using Tiku.Domain.Content; @@ -305,6 +307,8 @@ public sealed class ContentManagementEndpointTests item.TenantId == tenantId && item.Code == "integration_test_admin"); role.DataScope = JsonSerializer.SerializeToElement(value); await dbContext.SaveChangesAsync(); + await scope.ServiceProvider.GetRequiredService() + .BumpScopeAsync(AuthRealm.Tenant, tenantId); } private static async Task ReadJsonAsync(HttpResponseMessage response) @@ -312,4 +316,4 @@ public sealed class ContentManagementEndpointTests var stream = await response.Content.ReadAsStreamAsync(); return await JsonDocument.ParseAsync(stream); } -} \ No newline at end of file +} diff --git a/Tiku.IntegrationTests/Api/TenantCommerceEndpointTests.cs b/Tiku.IntegrationTests/Api/TenantCommerceEndpointTests.cs index 227aac2..bb2fcfd 100644 --- a/Tiku.IntegrationTests/Api/TenantCommerceEndpointTests.cs +++ b/Tiku.IntegrationTests/Api/TenantCommerceEndpointTests.cs @@ -7,6 +7,8 @@ using Microsoft.Extensions.DependencyInjection; using Tiku.Api.Contracts; using Tiku.Application.Commerce; using Tiku.Application.Jobs; +using Tiku.Application.Auth; +using Tiku.Application.Security; using Tiku.Domain.Catalog; using Tiku.Domain.Commerce; using Tiku.Domain.Identity; @@ -676,6 +678,8 @@ public sealed class TenantCommerceEndpointTests item.TenantId == tenantId && item.Code == "integration_test_admin"); role.DataScope = JsonSerializer.SerializeToElement(value); await dbContext.SaveChangesAsync(); + await scope.ServiceProvider.GetRequiredService() + .BumpScopeAsync(AuthRealm.Tenant, tenantId); } private sealed record LoginSeed(Guid TenantId, Guid UserId, string Phone); @@ -698,4 +702,4 @@ public sealed class TenantCommerceEndpointTests throw new NotSupportedException(); } } -} \ No newline at end of file +}