mirror of
https://github.com/bitwarden/server
synced 2026-01-03 00:53:37 +00:00
Remove the u2f lib (#1820)
This commit is contained in:
@@ -1,62 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Identity;
|
||||
using Bit.Test.Common.AutoFixture;
|
||||
using Bit.Test.Common.AutoFixture.Attributes;
|
||||
using NSubstitute;
|
||||
using Xunit;
|
||||
|
||||
namespace Bit.Core.Test.Identity
|
||||
{
|
||||
public class U2fTokenProviderTests : BaseTokenProviderTests<U2fTokenProvider>
|
||||
{
|
||||
public override TwoFactorProviderType TwoFactorProviderType => TwoFactorProviderType.U2f;
|
||||
|
||||
public static IEnumerable<object[]> CanGenerateTwoFactorTokenAsyncData()
|
||||
{
|
||||
return new[]
|
||||
{
|
||||
new object[]
|
||||
{
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
["Something"] = "Hello"
|
||||
},
|
||||
true, // canAccessPremium
|
||||
true, // expectedResponse
|
||||
},
|
||||
new object[]
|
||||
{
|
||||
new Dictionary<string, object>(),
|
||||
true, // canAccessPremium
|
||||
false, // expectedResponse
|
||||
},
|
||||
new object[]
|
||||
{
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
["Key"] = "Value"
|
||||
},
|
||||
false, // canAccessPremium
|
||||
false, // expectedResponse
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
[Theory, BitMemberAutoData(nameof(CanGenerateTwoFactorTokenAsyncData))]
|
||||
public async Task CanGenerateTwoFactorTokenAsync_Success(Dictionary<string, object> metaData, bool canAccessPremium,
|
||||
bool expectedResponse, User user, SutProvider<U2fTokenProvider> sutProvider)
|
||||
{
|
||||
var userManager = SubstituteUserManager();
|
||||
MockDatabase(user, metaData);
|
||||
AdditionalSetup(sutProvider, user)
|
||||
.CanAccessPremium(user)
|
||||
.Returns(canAccessPremium);
|
||||
|
||||
var response = await sutProvider.Sut.CanGenerateTwoFactorTokenAsync(userManager, user);
|
||||
Assert.Equal(expectedResponse, response);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user