1
0
mirror of https://github.com/bitwarden/server synced 2026-01-07 11:03:37 +00:00

[PM-24549] Remove feature flag: use-pricing-service (#6567)

* Remove feature flag and move StaticStore plans to MockPlans for tests

* Remove old plan models / move sponsored plans out of StaticStore

* Run dotnet format

* Add pricing URI to Development appsettings for local development and integration tests

* Updated Api Integration tests to get current plan type

* Run dotnet format

* Fix failing tests
This commit is contained in:
Alex Morask
2025-11-19 09:53:30 -06:00
committed by GitHub
parent 1eb396cb40
commit f595818ede
83 changed files with 367 additions and 407 deletions

View File

@@ -2,7 +2,7 @@
using Bit.Core.Billing.Enums;
using Bit.Core.Models.Business;
using Bit.Core.Test.AutoFixture.OrganizationFixtures;
using Bit.Core.Utilities;
using Bit.Core.Test.Billing.Mocks;
using Bit.Test.Common.AutoFixture.Attributes;
using Stripe;
using Xunit;
@@ -17,7 +17,7 @@ public class CompleteSubscriptionUpdateTests
public void UpgradeItemOptions_TeamsStarterToTeams_ReturnsCorrectOptions(
Organization organization)
{
var teamsStarterPlan = StaticStore.GetPlan(PlanType.TeamsStarter);
var teamsStarterPlan = MockPlans.Get(PlanType.TeamsStarter);
var subscription = new Subscription
{
@@ -35,7 +35,7 @@ public class CompleteSubscriptionUpdateTests
}
};
var teamsMonthlyPlan = StaticStore.GetPlan(PlanType.TeamsMonthly);
var teamsMonthlyPlan = MockPlans.Get(PlanType.TeamsMonthly);
var updatedSubscriptionData = new SubscriptionData
{
@@ -66,7 +66,7 @@ public class CompleteSubscriptionUpdateTests
// 5 purchased, 1 base
organization.MaxStorageGb = 6;
var teamsMonthlyPlan = StaticStore.GetPlan(PlanType.TeamsMonthly);
var teamsMonthlyPlan = MockPlans.Get(PlanType.TeamsMonthly);
var subscription = new Subscription
{
@@ -102,7 +102,7 @@ public class CompleteSubscriptionUpdateTests
}
};
var enterpriseMonthlyPlan = StaticStore.GetPlan(PlanType.EnterpriseMonthly);
var enterpriseMonthlyPlan = MockPlans.Get(PlanType.EnterpriseMonthly);
var updatedSubscriptionData = new SubscriptionData
{
@@ -173,7 +173,7 @@ public class CompleteSubscriptionUpdateTests
// 5 purchased, 1 base
organization.MaxStorageGb = 6;
var teamsMonthlyPlan = StaticStore.GetPlan(PlanType.TeamsMonthly);
var teamsMonthlyPlan = MockPlans.Get(PlanType.TeamsMonthly);
var subscription = new Subscription
{
@@ -209,7 +209,7 @@ public class CompleteSubscriptionUpdateTests
}
};
var enterpriseMonthlyPlan = StaticStore.GetPlan(PlanType.EnterpriseMonthly);
var enterpriseMonthlyPlan = MockPlans.Get(PlanType.EnterpriseMonthly);
var updatedSubscriptionData = new SubscriptionData
{
@@ -277,8 +277,8 @@ public class CompleteSubscriptionUpdateTests
public void RevertItemOptions_TeamsStarterToTeams_ReturnsCorrectOptions(
Organization organization)
{
var teamsStarterPlan = StaticStore.GetPlan(PlanType.TeamsStarter);
var teamsMonthlyPlan = StaticStore.GetPlan(PlanType.TeamsMonthly);
var teamsStarterPlan = MockPlans.Get(PlanType.TeamsStarter);
var teamsMonthlyPlan = MockPlans.Get(PlanType.TeamsMonthly);
var subscription = new Subscription
{
@@ -325,8 +325,8 @@ public class CompleteSubscriptionUpdateTests
// 5 purchased, 1 base
organization.MaxStorageGb = 6;
var teamsMonthlyPlan = StaticStore.GetPlan(PlanType.TeamsMonthly);
var enterpriseMonthlyPlan = StaticStore.GetPlan(PlanType.EnterpriseMonthly);
var teamsMonthlyPlan = MockPlans.Get(PlanType.TeamsMonthly);
var enterpriseMonthlyPlan = MockPlans.Get(PlanType.EnterpriseMonthly);
var subscription = new Subscription
{
@@ -431,8 +431,8 @@ public class CompleteSubscriptionUpdateTests
// 5 purchased, 1 base
organization.MaxStorageGb = 6;
var teamsMonthlyPlan = StaticStore.GetPlan(PlanType.TeamsMonthly);
var enterpriseMonthlyPlan = StaticStore.GetPlan(PlanType.EnterpriseMonthly);
var teamsMonthlyPlan = MockPlans.Get(PlanType.TeamsMonthly);
var enterpriseMonthlyPlan = MockPlans.Get(PlanType.EnterpriseMonthly);
var subscription = new Subscription
{

View File

@@ -1,7 +1,7 @@
using Bit.Core.AdminConsole.Entities;
using Bit.Core.Billing.Enums;
using Bit.Core.Models.Business;
using Bit.Core.Utilities;
using Bit.Core.Test.Billing.Mocks;
using Bit.Test.Common.AutoFixture.Attributes;
using Stripe;
using Xunit;
@@ -27,7 +27,7 @@ public class SeatSubscriptionUpdateTests
public void UpgradeItemsOptions_ReturnsCorrectOptions(PlanType planType, Organization organization)
{
var plan = StaticStore.GetPlan(planType);
var plan = MockPlans.Get(planType);
organization.PlanType = planType;
var subscription = new Subscription
{
@@ -69,7 +69,7 @@ public class SeatSubscriptionUpdateTests
[BitAutoData(PlanType.TeamsAnnually)]
public void RevertItemsOptions_ReturnsCorrectOptions(PlanType planType, Organization organization)
{
var plan = StaticStore.GetPlan(planType);
var plan = MockPlans.Get(planType);
organization.PlanType = planType;
var subscription = new Subscription
{

View File

@@ -4,7 +4,7 @@ using Bit.Core.Exceptions;
using Bit.Core.Models.Business;
using Bit.Core.Models.StaticStore;
using Bit.Core.Test.AutoFixture.OrganizationFixtures;
using Bit.Core.Utilities;
using Bit.Core.Test.Billing.Mocks;
using Bit.Test.Common.AutoFixture.Attributes;
using Xunit;
@@ -16,7 +16,7 @@ public class SecretsManagerSubscriptionUpdateTests
private static TheoryData<Plan> ToPlanTheory(List<PlanType> types)
{
var theoryData = new TheoryData<Plan>();
var plans = types.Select(StaticStore.GetPlan).ToArray();
var plans = types.Select(MockPlans.Get).ToArray();
theoryData.AddRange(plans);
return theoryData;
}

View File

@@ -1,7 +1,7 @@
using Bit.Core.AdminConsole.Entities;
using Bit.Core.Billing.Enums;
using Bit.Core.Models.Business;
using Bit.Core.Utilities;
using Bit.Core.Test.Billing.Mocks;
using Bit.Test.Common.AutoFixture.Attributes;
using Stripe;
using Xunit;
@@ -27,7 +27,7 @@ public class ServiceAccountSubscriptionUpdateTests
public void UpgradeItemsOptions_ReturnsCorrectOptions(PlanType planType, Organization organization)
{
var plan = StaticStore.GetPlan(planType);
var plan = MockPlans.Get(planType);
organization.PlanType = planType;
var subscription = new Subscription
{
@@ -69,7 +69,7 @@ public class ServiceAccountSubscriptionUpdateTests
[BitAutoData(PlanType.TeamsAnnually)]
public void RevertItemsOptions_ReturnsCorrectOptions(PlanType planType, Organization organization)
{
var plan = StaticStore.GetPlan(planType);
var plan = MockPlans.Get(planType);
organization.PlanType = planType;
var quantity = 5;
var subscription = new Subscription

View File

@@ -1,7 +1,7 @@
using Bit.Core.AdminConsole.Entities;
using Bit.Core.Billing.Enums;
using Bit.Core.Models.Business;
using Bit.Core.Utilities;
using Bit.Core.Test.Billing.Mocks;
using Bit.Test.Common.AutoFixture.Attributes;
using Stripe;
using Xunit;
@@ -27,7 +27,7 @@ public class SmSeatSubscriptionUpdateTests
public void UpgradeItemsOptions_ReturnsCorrectOptions(PlanType planType, Organization organization)
{
var plan = StaticStore.GetPlan(planType);
var plan = MockPlans.Get(planType);
organization.PlanType = planType;
var quantity = 3;
var subscription = new Subscription
@@ -70,7 +70,7 @@ public class SmSeatSubscriptionUpdateTests
[BitAutoData(PlanType.TeamsAnnually)]
public void RevertItemsOptions_ReturnsCorrectOptions(PlanType planType, Organization organization)
{
var plan = StaticStore.GetPlan(planType);
var plan = MockPlans.Get(planType);
organization.PlanType = planType;
var quantity = 5;
var subscription = new Subscription

View File

@@ -1,6 +1,6 @@
using Bit.Core.Billing.Enums;
using Bit.Core.Models.Business;
using Bit.Core.Utilities;
using Bit.Core.Test.Billing.Mocks;
using Bit.Test.Common.AutoFixture.Attributes;
using Stripe;
using Xunit;
@@ -26,7 +26,7 @@ public class StorageSubscriptionUpdateTests
public void UpgradeItemsOptions_ReturnsCorrectOptions(PlanType planType)
{
var plan = StaticStore.GetPlan(planType);
var plan = MockPlans.Get(planType);
var subscription = new Subscription
{
Items = new StripeList<SubscriptionItem>
@@ -77,7 +77,7 @@ public class StorageSubscriptionUpdateTests
[BitAutoData(PlanType.TeamsStarter)]
public void RevertItemsOptions_ReturnsCorrectOptions(PlanType planType)
{
var plan = StaticStore.GetPlan(planType);
var plan = MockPlans.Get(planType);
var subscription = new Subscription
{
Items = new StripeList<SubscriptionItem>