mirror of
https://github.com/bitwarden/server.git
synced 2024-12-05 14:23:30 +01:00
aa34bbb0e6
* Add Collections Tests * Update CollectionRepository Implementation * Test Adding And Deleting Through Replace * Format * Fix Most Test Warnings * Format
46 lines
1.5 KiB
C#
46 lines
1.5 KiB
C#
using Bit.Core.Auth.Entities;
|
|
using Bit.Core.Auth.Enums;
|
|
using Bit.Core.Entities;
|
|
using Bit.Core.Repositories;
|
|
using Xunit;
|
|
|
|
namespace Bit.Infrastructure.IntegrationTest.Auth.Repositories;
|
|
|
|
public class EmergencyAccessRepositoriesTests
|
|
{
|
|
[DatabaseTheory, DatabaseData]
|
|
public async Task DeleteAsync_UpdatesRevisionDate(IUserRepository userRepository,
|
|
IEmergencyAccessRepository emergencyAccessRepository)
|
|
{
|
|
var grantorUser = await userRepository.CreateAsync(new User
|
|
{
|
|
Name = "Test Grantor User",
|
|
Email = $"test+grantor{Guid.NewGuid()}@email.com",
|
|
ApiKey = "TEST",
|
|
SecurityStamp = "stamp",
|
|
});
|
|
|
|
var granteeUser = await userRepository.CreateAsync(new User
|
|
{
|
|
Name = "Test Grantee User",
|
|
Email = $"test+grantee{Guid.NewGuid()}@email.com",
|
|
ApiKey = "TEST",
|
|
SecurityStamp = "stamp",
|
|
});
|
|
|
|
var emergencyAccess = await emergencyAccessRepository.CreateAsync(new EmergencyAccess
|
|
{
|
|
GrantorId = grantorUser.Id,
|
|
GranteeId = granteeUser.Id,
|
|
Status = EmergencyAccessStatusType.Confirmed,
|
|
});
|
|
|
|
await emergencyAccessRepository.DeleteAsync(emergencyAccess);
|
|
|
|
var updatedGrantee = await userRepository.GetByIdAsync(granteeUser.Id);
|
|
|
|
Assert.NotNull(updatedGrantee);
|
|
Assert.NotEqual(updatedGrantee.AccountRevisionDate, granteeUser.AccountRevisionDate);
|
|
}
|
|
}
|