mirror of
https://github.com/bitwarden/server
synced 2026-01-08 03:23:20 +00: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