mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 07:36:14 -05:00
[AC-2488] Add billing endpoint to determine SM standalone for organization (#4014)
* Add billing endpoint to determine SM standalone for org. * Add missing attribute
This commit is contained in:
@ -0,0 +1,43 @@
|
||||
using Bit.Api.Billing.Controllers;
|
||||
using Bit.Api.Billing.Models.Responses;
|
||||
using Bit.Core.Billing.Models;
|
||||
using Bit.Core.Billing.Queries;
|
||||
using Bit.Test.Common.AutoFixture;
|
||||
using Bit.Test.Common.AutoFixture.Attributes;
|
||||
using Microsoft.AspNetCore.Http.HttpResults;
|
||||
using NSubstitute;
|
||||
using Xunit;
|
||||
|
||||
namespace Bit.Api.Test.Billing.Controllers;
|
||||
|
||||
[ControllerCustomize(typeof(OrganizationBillingController))]
|
||||
[SutProviderCustomize]
|
||||
public class OrganizationBillingControllerTests
|
||||
{
|
||||
[Theory, BitAutoData]
|
||||
public async Task GetMetadataAsync_MetadataNull_NotFound(
|
||||
Guid organizationId,
|
||||
SutProvider<OrganizationBillingController> sutProvider)
|
||||
{
|
||||
var result = await sutProvider.Sut.GetMetadataAsync(organizationId);
|
||||
|
||||
Assert.IsType<NotFound>(result);
|
||||
}
|
||||
|
||||
[Theory, BitAutoData]
|
||||
public async Task GetMetadataAsync_OK(
|
||||
Guid organizationId,
|
||||
SutProvider<OrganizationBillingController> sutProvider)
|
||||
{
|
||||
sutProvider.GetDependency<IOrganizationBillingQueries>().GetMetadata(organizationId)
|
||||
.Returns(new OrganizationMetadataDTO(true));
|
||||
|
||||
var result = await sutProvider.Sut.GetMetadataAsync(organizationId);
|
||||
|
||||
Assert.IsType<Ok<OrganizationMetadataResponse>>(result);
|
||||
|
||||
var organizationMetadataResponse = ((Ok<OrganizationMetadataResponse>)result).Value;
|
||||
|
||||
Assert.True(organizationMetadataResponse.IsOnSecretsManagerStandalone);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user