mirror of
https://github.com/bitwarden/server.git
synced 2025-06-28 06:36:15 -05:00
fix tests
This commit is contained in:
parent
ea02dfbcbc
commit
36879fe1f9
@ -9,7 +9,6 @@ using Bit.Core.AdminConsole.Repositories;
|
||||
using Bit.Core.AdminConsole.Utilities.Commands;
|
||||
using Bit.Core.AdminConsole.Utilities.Errors;
|
||||
using Bit.Core.AdminConsole.Utilities.Validation;
|
||||
using Bit.Core.Context;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Business;
|
||||
|
@ -40,47 +40,6 @@ public class OrganizationServiceTests
|
||||
{
|
||||
private readonly IDataProtectorTokenFactory<OrgUserInviteTokenable> _orgUserInviteTokenDataFactory = new FakeDataProtectorTokenFactory<OrgUserInviteTokenable>();
|
||||
|
||||
[Theory, BitAutoData]
|
||||
public async Task SignupClientAsync_Succeeds(
|
||||
OrganizationSignup signup,
|
||||
SutProvider<OrganizationService> sutProvider)
|
||||
{
|
||||
signup.Plan = PlanType.TeamsMonthly;
|
||||
|
||||
var plan = StaticStore.GetPlan(signup.Plan);
|
||||
|
||||
sutProvider.GetDependency<IPricingClient>().GetPlanOrThrow(signup.Plan).Returns(plan);
|
||||
|
||||
var (organization, _, _) = await sutProvider.Sut.SignupClientAsync(signup);
|
||||
|
||||
await sutProvider.GetDependency<IOrganizationRepository>().Received(1).CreateAsync(Arg.Is<Organization>(org =>
|
||||
org.Id == organization.Id &&
|
||||
org.Name == signup.Name &&
|
||||
org.Plan == plan.Name &&
|
||||
org.PlanType == plan.Type &&
|
||||
org.UsePolicies == plan.HasPolicies &&
|
||||
org.PublicKey == signup.PublicKey &&
|
||||
org.PrivateKey == signup.PrivateKey &&
|
||||
org.UseSecretsManager == false));
|
||||
|
||||
await sutProvider.GetDependency<IOrganizationApiKeyRepository>().Received(1)
|
||||
.CreateAsync(Arg.Is<OrganizationApiKey>(orgApiKey =>
|
||||
orgApiKey.OrganizationId == organization.Id));
|
||||
|
||||
await sutProvider.GetDependency<IApplicationCacheService>().Received(1)
|
||||
.UpsertOrganizationAbilityAsync(organization);
|
||||
|
||||
await sutProvider.GetDependency<IOrganizationUserRepository>().DidNotReceiveWithAnyArgs().CreateAsync(default);
|
||||
|
||||
await sutProvider.GetDependency<ICollectionRepository>().Received(1)
|
||||
.CreateAsync(Arg.Is<Collection>(c => c.Name == signup.CollectionName && c.OrganizationId == organization.Id), null, null);
|
||||
|
||||
await sutProvider.GetDependency<IReferenceEventService>().Received(1).RaiseEventAsync(Arg.Is<ReferenceEvent>(
|
||||
re =>
|
||||
re.Type == ReferenceEventType.Signup &&
|
||||
re.PlanType == plan.Type));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[OrganizationInviteCustomize(InviteeUserType = OrganizationUserType.User,
|
||||
InvitorUserType = OrganizationUserType.Owner), OrganizationCustomize, BitAutoData]
|
||||
|
Loading…
x
Reference in New Issue
Block a user