1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-02 08:32:50 -05:00

[AC-1568] Refactor UpdateSecretsManagerSubscriptionCommandTests to use new ctor (#3210)

This commit is contained in:
Thomas Rittson
2023-08-22 09:55:39 +10:00
committed by GitHub
parent f9452e7b77
commit c5b5225642
3 changed files with 459 additions and 534 deletions

View File

@ -20,11 +20,11 @@ public class OrganizationCustomization : ICustomization
public void Customize(IFixture fixture)
{
var organizationId = Guid.NewGuid();
var maxConnections = (short)new Random().Next(10, short.MaxValue);
var maxCollections = (short)new Random().Next(10, short.MaxValue);
fixture.Customize<Organization>(composer => composer
.With(o => o.Id, organizationId)
.With(o => o.MaxCollections, maxConnections)
.With(o => o.MaxCollections, maxCollections)
.With(o => o.UseGroups, UseGroups));
fixture.Customize<Collection>(composer =>
@ -127,6 +127,24 @@ internal class OrganizationInvite : ICustomization
}
}
public class SecretsManagerOrganizationCustomization : ICustomization
{
public void Customize(IFixture fixture)
{
var organizationId = Guid.NewGuid();
var planType = PlanType.EnterpriseAnnually;
fixture.Customize<Organization>(composer => composer
.With(o => o.Id, organizationId)
.With(o => o.UseSecretsManager, true)
.With(o => o.PlanType, planType)
.With(o => o.Plan, StaticStore.GetPasswordManagerPlan(planType).Name)
.With(o => o.MaxAutoscaleSmSeats, (int?)null)
.With(o => o.MaxAutoscaleSmServiceAccounts, (int?)null)
);
}
}
internal class OrganizationCustomizeAttribute : BitCustomizeAttribute
{
public bool UseGroups { get; set; }
@ -162,3 +180,9 @@ internal class OrganizationInviteCustomizeAttribute : BitCustomizeAttribute
PermissionsBlob = PermissionsBlob,
};
}
internal class SecretsManagerOrganizationCustomizeAttribute : BitCustomizeAttribute
{
public override ICustomization GetCustomization() =>
new SecretsManagerOrganizationCustomization();
}