2022-06-30 01:46:41 +02:00
|
|
|
|
using Bit.Core.Entities;
|
2022-01-21 15:36:25 +01:00
|
|
|
|
using Bit.Core.Enums;
|
|
|
|
|
using Bit.Core.Identity;
|
|
|
|
|
using Bit.Test.Common.AutoFixture;
|
|
|
|
|
using Bit.Test.Common.AutoFixture.Attributes;
|
|
|
|
|
using Xunit;
|
|
|
|
|
|
|
|
|
|
namespace Bit.Core.Test.Identity;
|
2022-08-29 22:06:55 +02:00
|
|
|
|
|
2022-01-21 15:36:25 +01:00
|
|
|
|
public class AuthenticationTokenProviderTests : BaseTokenProviderTests<AuthenticatorTokenProvider>
|
|
|
|
|
{
|
|
|
|
|
public override TwoFactorProviderType TwoFactorProviderType => TwoFactorProviderType.Authenticator;
|
|
|
|
|
|
|
|
|
|
public static IEnumerable<object[]> CanGenerateTwoFactorTokenAsyncData
|
|
|
|
|
=> SetupCanGenerateData(
|
|
|
|
|
(
|
|
|
|
|
new Dictionary<string, object>
|
|
|
|
|
{
|
|
|
|
|
["Key"] = "stuff",
|
|
|
|
|
},
|
|
|
|
|
true
|
|
|
|
|
),
|
|
|
|
|
(
|
|
|
|
|
new Dictionary<string, object>
|
|
|
|
|
{
|
|
|
|
|
["Key"] = ""
|
|
|
|
|
},
|
|
|
|
|
false
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
[Theory, BitMemberAutoData(nameof(CanGenerateTwoFactorTokenAsyncData))]
|
|
|
|
|
public override async Task RunCanGenerateTwoFactorTokenAsync(Dictionary<string, object> metaData, bool expectedResponse,
|
|
|
|
|
User user, SutProvider<AuthenticatorTokenProvider> sutProvider)
|
|
|
|
|
{
|
|
|
|
|
await base.RunCanGenerateTwoFactorTokenAsync(metaData, expectedResponse, user, sutProvider);
|
|
|
|
|
}
|
|
|
|
|
}
|