1
0
mirror of https://github.com/bitwarden/server synced 2026-01-06 02:23:51 +00:00

Add FeatureServiceFixtures to set feature flags in test

This commit is contained in:
Thomas Rittson
2023-10-11 14:49:26 +10:00
parent ea4b282c6b
commit 60ea32bb1d
3 changed files with 78 additions and 14 deletions

View File

@@ -112,7 +112,9 @@ public class CollectionServiceTest
{
collection.Id = default;
sutProvider.GetDependency<IOrganizationRepository>().GetByIdAsync(organization.Id).Returns(organization);
sutProvider.EnableFeatureFlag(FeatureFlagKeys.FlexibleCollections);
sutProvider.GetDependency<IFeatureService>()
.IsEnabled(FeatureFlagKeys.FlexibleCollections, Arg.Any<ICurrentContext>(), Arg.Any<bool>())
.Returns(true);
var ex = await Assert.ThrowsAsync<BadRequestException>(() => sutProvider.Sut.SaveAsync(collection, null, users));
Assert.Contains("At least one member or group must have can manage permission.", ex.Message);