mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 08:02:49 -05:00
Fix Most Test Warnings (#4612)
* Add Collections Tests * Update CollectionRepository Implementation * Test Adding And Deleting Through Replace * Format * Fix Most Test Warnings * Format
This commit is contained in:
@ -1115,7 +1115,7 @@ OrganizationUserInvite invite, SutProvider<OrganizationService> sutProvider)
|
||||
|
||||
await sutProvider.Sut.InviteUsersAsync(organization.Id, savingUser.Id, systemUser: null, invites);
|
||||
|
||||
sutProvider.GetDependency<IUpdateSecretsManagerSubscriptionCommand>().Received(1)
|
||||
await sutProvider.GetDependency<IUpdateSecretsManagerSubscriptionCommand>().Received(1)
|
||||
.UpdateSubscriptionAsync(Arg.Is<SecretsManagerSubscriptionUpdate>(update =>
|
||||
update.SmSeats == organization.SmSeats + invitedSmUsers &&
|
||||
!update.SmServiceAccountsChanged &&
|
||||
@ -1158,7 +1158,7 @@ OrganizationUserInvite invite, SutProvider<OrganizationService> sutProvider)
|
||||
// OrgUser is reverted
|
||||
// Note: we don't know what their guids are so comparing length is the best we can do
|
||||
var invitedEmails = invites.SelectMany(i => i.invite.Emails);
|
||||
sutProvider.GetDependency<IOrganizationUserRepository>().Received(1).DeleteManyAsync(
|
||||
await sutProvider.GetDependency<IOrganizationUserRepository>().Received(1).DeleteManyAsync(
|
||||
Arg.Is<IEnumerable<Guid>>(ids => ids.Count() == invitedEmails.Count()));
|
||||
|
||||
Received.InOrder(() =>
|
||||
|
@ -57,7 +57,7 @@ public class AddSecretsManagerSubscriptionCommandTests
|
||||
|
||||
// TODO: call ReferenceEventService - see AC-1481
|
||||
|
||||
sutProvider.GetDependency<IOrganizationService>().Received(1).ReplaceAndUpdateCacheAsync(Arg.Is<Organization>(c =>
|
||||
await sutProvider.GetDependency<IOrganizationService>().Received(1).ReplaceAndUpdateCacheAsync(Arg.Is<Organization>(c =>
|
||||
c.SmSeats == plan.SecretsManager.BaseSeats + additionalSmSeats &&
|
||||
c.SmServiceAccounts == plan.SecretsManager.BaseServiceAccount + additionalServiceAccounts &&
|
||||
c.UseSecretsManager == true));
|
||||
|
@ -663,8 +663,8 @@ public class UpdateSecretsManagerSubscriptionCommandTests
|
||||
.SendOrganizationMaxSeatLimitReachedEmailAsync(Arg.Any<Organization>(), Arg.Any<int>(),
|
||||
Arg.Any<IEnumerable<string>>());
|
||||
|
||||
sutProvider.GetDependency<IOrganizationRepository>().DidNotReceiveWithAnyArgs().ReplaceAsync(default);
|
||||
sutProvider.GetDependency<IApplicationCacheService>().DidNotReceiveWithAnyArgs().UpsertOrganizationAbilityAsync(default);
|
||||
await sutProvider.GetDependency<IOrganizationRepository>().DidNotReceiveWithAnyArgs().ReplaceAsync(default);
|
||||
await sutProvider.GetDependency<IApplicationCacheService>().DidNotReceiveWithAnyArgs().UpsertOrganizationAbilityAsync(default);
|
||||
}
|
||||
|
||||
private void AssertUpdatedOrganization(Func<Organization> organizationMatcher, SutProvider<UpdateSecretsManagerSubscriptionCommand> sutProvider)
|
||||
|
@ -165,7 +165,7 @@ public class UpgradeOrganizationPlanCommandTests
|
||||
var exception = await Assert.ThrowsAsync<BadRequestException>(() => sutProvider.Sut.UpgradePlanAsync(organization.Id, upgrade));
|
||||
Assert.Contains("Your organization currently has 2 Secrets Manager seats filled. Your new plan only has", exception.Message);
|
||||
|
||||
sutProvider.GetDependency<IOrganizationService>().DidNotReceiveWithAnyArgs().ReplaceAndUpdateCacheAsync(default);
|
||||
await sutProvider.GetDependency<IOrganizationService>().DidNotReceiveWithAnyArgs().ReplaceAndUpdateCacheAsync(default);
|
||||
}
|
||||
|
||||
[Theory, FreeOrganizationUpgradeCustomize]
|
||||
@ -194,6 +194,6 @@ public class UpgradeOrganizationPlanCommandTests
|
||||
var exception = await Assert.ThrowsAsync<BadRequestException>(() => sutProvider.Sut.UpgradePlanAsync(organization.Id, upgrade));
|
||||
Assert.Contains($"Your organization currently has {currentServiceAccounts} machine accounts. Your new plan only allows", exception.Message);
|
||||
|
||||
sutProvider.GetDependency<IOrganizationService>().DidNotReceiveWithAnyArgs().ReplaceAndUpdateCacheAsync(default);
|
||||
await sutProvider.GetDependency<IOrganizationService>().DidNotReceiveWithAnyArgs().ReplaceAndUpdateCacheAsync(default);
|
||||
}
|
||||
}
|
||||
|
@ -62,11 +62,12 @@ public class BulkAuthorizationHandlerTests
|
||||
|
||||
private class TestBulkAuthorizationHandler : BulkAuthorizationHandler<TestOperationRequirement, TestResource>
|
||||
{
|
||||
protected override async Task HandleRequirementAsync(AuthorizationHandlerContext context,
|
||||
protected override Task HandleRequirementAsync(AuthorizationHandlerContext context,
|
||||
TestOperationRequirement requirement,
|
||||
ICollection<TestResource> resources)
|
||||
{
|
||||
context.Succeed(requirement);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user