1
0
mirror of https://github.com/bitwarden/server synced 2026-03-01 02:41:33 +00:00

fix for tests.

This commit is contained in:
Jared McCannon
2026-01-21 11:04:39 -06:00
parent c3bbed780d
commit bf95968050
3 changed files with 22 additions and 41 deletions

View File

@@ -1372,13 +1372,10 @@ public class RestoreOrganizationUserCommandTests
.GetManyAsync(Arg.Is<IEnumerable<Guid>>(ids => ids.Contains(orgUser1.Id) && ids.Contains(orgUser2.Id)))
.Returns([orgUser1, orgUser2]);
// Setup policy for orgUser1 (the one with UserId)
SetupOrganizationDataOwnershipPolicy(
sutProvider,
orgUser1.UserId!.Value,
organization.Id,
OrganizationUserStatusType.Revoked,
policyEnabled: true);
// Setup bulk policy query - returns org user IDs with policy enabled
sutProvider.GetDependency<IPolicyRequirementQuery>()
.GetManyByOrganizationIdAsync<OrganizationDataOwnershipPolicyRequirement>(organization.Id)
.Returns([orgUser1.Id]);
sutProvider.GetDependency<ITwoFactorIsEnabledQuery>()
.TwoFactorIsEnabledAsync(Arg.Any<IEnumerable<Guid>>())
@@ -1428,21 +1425,10 @@ public class RestoreOrganizationUserCommandTests
.GetManyAsync(Arg.Is<IEnumerable<Guid>>(ids => ids.Contains(orgUser1.Id) && ids.Contains(orgUser2.Id)))
.Returns([orgUser1, orgUser2]);
// Setup policy enabled only for orgUser1
SetupOrganizationDataOwnershipPolicy(
sutProvider,
orgUser1.UserId!.Value,
organization.Id,
OrganizationUserStatusType.Revoked,
policyEnabled: true);
// Setup policy disabled for orgUser2
SetupOrganizationDataOwnershipPolicy(
sutProvider,
orgUser2.UserId!.Value,
organization.Id,
OrganizationUserStatusType.Revoked,
policyEnabled: false);
// Setup bulk policy query - only orgUser1 has policy enabled
sutProvider.GetDependency<IPolicyRequirementQuery>()
.GetManyByOrganizationIdAsync<OrganizationDataOwnershipPolicyRequirement>(organization.Id)
.Returns([orgUser1.Id]);
sutProvider.GetDependency<ITwoFactorIsEnabledQuery>()
.TwoFactorIsEnabledAsync(Arg.Any<IEnumerable<Guid>>())
@@ -1492,20 +1478,10 @@ public class RestoreOrganizationUserCommandTests
.GetManyAsync(Arg.Is<IEnumerable<Guid>>(ids => ids.Contains(orgUser1.Id) && ids.Contains(orgUser2.Id)))
.Returns([orgUser1, orgUser2]);
// Setup policy enabled for both users
SetupOrganizationDataOwnershipPolicy(
sutProvider,
orgUser1.UserId!.Value,
organization.Id,
OrganizationUserStatusType.Revoked,
policyEnabled: true);
SetupOrganizationDataOwnershipPolicy(
sutProvider,
orgUser2.UserId!.Value,
organization.Id,
OrganizationUserStatusType.Revoked,
policyEnabled: true);
// Setup bulk policy query - both users have policy enabled
sutProvider.GetDependency<IPolicyRequirementQuery>()
.GetManyByOrganizationIdAsync<OrganizationDataOwnershipPolicyRequirement>(organization.Id)
.Returns([orgUser1.Id, orgUser2.Id]);
sutProvider.GetDependency<ITwoFactorIsEnabledQuery>()
.TwoFactorIsEnabledAsync(Arg.Any<IEnumerable<Guid>>())