mirror of
https://github.com/bitwarden/server.git
synced 2024-11-25 12:45:18 +01:00
3eb4d547a8
* Upgraded old 2019 plans to have the same features as 2020 and beyond * Removed redundant test and moved additional test cases to GetByOrgIdAsync_SmNoneFreePlans_ReturnsNull * Fixed issue where feature flag wasn't returning correct plans * Added teams 2010 plan * Reverted accidental change to StripePaymentService * Split feature flag logic and added some explanatory comments * Removed families changes * Resolved issue where Teams Starter could not sign up for a new org with SM enabled * Fixed issue with signing up for SM with Teams Starter * Resolved issue where an active plan could increase their SM seat count to be greater than the base seats in the password manager plan * Updated unit test to ensure Seats are higher than SmSeats * Resolved issue where getting plans would return a value that LINQ previously cached when feature flag was in a different state
61 lines
2.0 KiB
C#
61 lines
2.0 KiB
C#
using Bit.Core.Entities;
|
|
using Bit.Core.Enums;
|
|
using Bit.Core.Exceptions;
|
|
using Bit.Core.Models.Business;
|
|
using Bit.Core.Test.AutoFixture.OrganizationFixtures;
|
|
using Bit.Test.Common.AutoFixture.Attributes;
|
|
using Xunit;
|
|
|
|
namespace Bit.Core.Test.Models.Business;
|
|
|
|
[SecretsManagerOrganizationCustomize]
|
|
public class SecretsManagerSubscriptionUpdateTests
|
|
{
|
|
[Theory]
|
|
[BitAutoData(PlanType.Custom)]
|
|
[BitAutoData(PlanType.FamiliesAnnually)]
|
|
[BitAutoData(PlanType.FamiliesAnnually2019)]
|
|
public Task UpdateSubscriptionAsync_WithNonSecretsManagerPlanType_ThrowsBadRequestException(
|
|
PlanType planType,
|
|
Organization organization)
|
|
{
|
|
// Arrange
|
|
organization.PlanType = planType;
|
|
|
|
// Act
|
|
var exception = Assert.Throws<NotFoundException>(() => new SecretsManagerSubscriptionUpdate(organization, false));
|
|
|
|
// Assert
|
|
Assert.Contains("Invalid Secrets Manager plan", exception.Message, StringComparison.InvariantCultureIgnoreCase);
|
|
return Task.CompletedTask;
|
|
}
|
|
|
|
[Theory]
|
|
[BitAutoData(PlanType.EnterpriseMonthly2019)]
|
|
[BitAutoData(PlanType.EnterpriseMonthly2020)]
|
|
[BitAutoData(PlanType.EnterpriseMonthly)]
|
|
[BitAutoData(PlanType.EnterpriseAnnually2019)]
|
|
[BitAutoData(PlanType.EnterpriseAnnually2020)]
|
|
[BitAutoData(PlanType.EnterpriseAnnually)]
|
|
[BitAutoData(PlanType.TeamsMonthly2019)]
|
|
[BitAutoData(PlanType.TeamsMonthly2020)]
|
|
[BitAutoData(PlanType.TeamsMonthly)]
|
|
[BitAutoData(PlanType.TeamsAnnually2019)]
|
|
[BitAutoData(PlanType.TeamsAnnually2020)]
|
|
[BitAutoData(PlanType.TeamsAnnually)]
|
|
[BitAutoData(PlanType.TeamsStarter)]
|
|
public void UpdateSubscription_WithNonSecretsManagerPlanType_DoesNotThrowException(
|
|
PlanType planType,
|
|
Organization organization)
|
|
{
|
|
// Arrange
|
|
organization.PlanType = planType;
|
|
|
|
// Act
|
|
var ex = Record.Exception(() => new SecretsManagerSubscriptionUpdate(organization, false));
|
|
|
|
// Assert
|
|
Assert.Null(ex);
|
|
}
|
|
}
|