mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-09-30 04:53:11 +00:00
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:
parent
cc7cda4818
commit
b116e71d16
1 changed files with 8 additions and 0 deletions
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue