mirror of
https://github.com/bitwarden/server.git
synced 2025-07-04 17:42:49 -05:00
Remove the u2f lib (#1820)
This commit is contained in:
@ -1,22 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Bit.Core.Entities;
|
||||
|
||||
namespace Bit.Core.Test.Repositories.EntityFramework.EqualityComparers
|
||||
{
|
||||
public class U2fCompare : IEqualityComparer<U2f>
|
||||
{
|
||||
public bool Equals(U2f x, U2f y)
|
||||
{
|
||||
return x.KeyHandle == y.KeyHandle &&
|
||||
x.Challenge == y.Challenge &&
|
||||
x.AppId == y.AppId &&
|
||||
x.Version == y.Version;
|
||||
}
|
||||
|
||||
public int GetHashCode([DisallowNull] U2f obj)
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Test.AutoFixture.Attributes;
|
||||
using Bit.Core.Test.AutoFixture.U2fFixtures;
|
||||
using Bit.Core.Test.Repositories.EntityFramework.EqualityComparers;
|
||||
using Xunit;
|
||||
using EfRepo = Bit.Infrastructure.EntityFramework.Repositories;
|
||||
using SqlRepo = Bit.Infrastructure.Dapper.Repositories;
|
||||
|
||||
namespace Bit.Core.Test.Repositories.EntityFramework
|
||||
{
|
||||
public class U2fRepositoryTests
|
||||
{
|
||||
|
||||
[CiSkippedTheory, EfU2fAutoData]
|
||||
public async void CreateAsync_Works_DataMatches(
|
||||
U2f u2f,
|
||||
User user,
|
||||
U2fCompare equalityComparer,
|
||||
List<EfRepo.U2fRepository> suts,
|
||||
List<EfRepo.UserRepository> efUserRepos,
|
||||
SqlRepo.U2fRepository sqlU2fRepo,
|
||||
SqlRepo.UserRepository sqlUserRepo
|
||||
)
|
||||
{
|
||||
var savedU2fs = new List<U2f>();
|
||||
foreach (var sut in suts)
|
||||
{
|
||||
var i = suts.IndexOf(sut);
|
||||
|
||||
var efUser = await efUserRepos[i].CreateAsync(user);
|
||||
sut.ClearChangeTracking();
|
||||
|
||||
u2f.UserId = efUser.Id;
|
||||
var postEfU2f = await sut.CreateAsync(u2f);
|
||||
sut.ClearChangeTracking();
|
||||
|
||||
var savedU2f = await sut.GetByIdAsync(postEfU2f.Id);
|
||||
savedU2fs.Add(savedU2f);
|
||||
}
|
||||
|
||||
var sqlUser = await sqlUserRepo.CreateAsync(user);
|
||||
|
||||
u2f.UserId = sqlUser.Id;
|
||||
var sqlU2f = await sqlU2fRepo.CreateAsync(u2f);
|
||||
var savedSqlU2f = await sqlU2fRepo.GetByIdAsync(sqlU2f.Id);
|
||||
savedU2fs.Add(savedSqlU2f);
|
||||
|
||||
var distinctItems = savedU2fs.Distinct(equalityComparer);
|
||||
Assert.True(!distinctItems.Skip(1).Any());
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user