From b116e71d168eb08abf41485ffd65f5f0ecbef3ee Mon Sep 17 00:00:00 2001 From: Alexandre Brandizzi Date: Thu, 24 Sep 2026 22:31:07 -0300 Subject: [PATCH] test(uplifts): grant the SH-393 ownership fixture actor RequestUplifts Uplift creation now checks the actor's RequestUplifts permission, so the ownership tests construct the service with the permission services and seed their actor as an Admin. --- .../WorkOrderUpliftDispatchOwnershipTests.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/SeaHavenIndustries.Tests/WorkOrderUpliftDispatchOwnershipTests.cs b/SeaHavenIndustries.Tests/WorkOrderUpliftDispatchOwnershipTests.cs index 840fd28..adba1a7 100644 --- a/SeaHavenIndustries.Tests/WorkOrderUpliftDispatchOwnershipTests.cs +++ b/SeaHavenIndustries.Tests/WorkOrderUpliftDispatchOwnershipTests.cs @@ -1,5 +1,6 @@ using Data.SeaHavenIndustries; using Data.SeaHavenIndustries.Enums; +using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Options; using SeaHaven.DataServices.Implementation; @@ -31,6 +32,11 @@ public sealed class WorkOrderUpliftDispatchOwnershipTests var context = new ApplicationDbContext(options); WorkOrderAccountTestHelpers.SeedBoardCreateScope(context); context.Vendors.Add(new Vendor { Id = 5, CompanyName = "Acme HVAC" }); + // SH-327: uplift creation checks the actor's RequestUplifts permission. + var adminRole = new IdentityRole("Admin"); + context.Roles.Add(adminRole); + context.Users.Add(new ApplicationUser { Id = "actor-1", UserName = "actor-1" }); + context.UserRoles.Add(new IdentityUserRole { UserId = "actor-1", RoleId = adminRole.Id }); context.SaveChanges(); return context; } @@ -67,6 +73,8 @@ public sealed class WorkOrderUpliftDispatchOwnershipTests new WorkOrderDetailDataService(context), WorkOrderAccountTestHelpers.Resolver(context), new UserDataService(context), + new TeamPermissionOverrideDataService(context), + new TeamPermissionPolicy(), TimeProvider.System, Options.Create(new ApprovalsOptions {