mirror of
https://github.com/bitwarden/server.git
synced 2025-07-03 17:12:49 -05:00
Add EnableFeatureFlag extension method for tests
This commit is contained in:
@ -1,4 +1,6 @@
|
||||
using AutoFixture;
|
||||
using Bit.Core;
|
||||
using Bit.Core.Context;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Settings;
|
||||
using NSubstitute;
|
||||
@ -47,4 +49,14 @@ public static class SutProviderExtensions
|
||||
.SetDependency(mockHttpClientFactory)
|
||||
.Create();
|
||||
}
|
||||
|
||||
public static SutProvider<T> EnableFeatureFlag<T>(this SutProvider<T> sutProvider,
|
||||
string featureFlagKey)
|
||||
{
|
||||
sutProvider.GetDependency<IFeatureService>()
|
||||
.IsEnabled(featureFlagKey, Arg.Any<ICurrentContext>(), Arg.Any<bool>())
|
||||
.Returns(true);
|
||||
|
||||
return sutProvider;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user