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.
This commit is contained in:
Alexandre Brandizzi 2026-09-24 22:31:07 -03:00
parent cc7cda4818
commit b116e71d16

View file

@ -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<string> { 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
{