mirror of
https://github.com/bitwarden/server.git
synced 2024-11-25 12:45:18 +01:00
efe91fd0d8
* Move RevisionDate Bumps to Extension Class * Add Tests against live databases * Run Formatting * Fix Typo * Fix Test Solution Typo * Await ReplaceAsync
47 lines
1.4 KiB
C#
47 lines
1.4 KiB
C#
using Bit.Core.Entities;
|
|
using Bit.Core.Enums;
|
|
using Bit.Core.Repositories;
|
|
using Xunit;
|
|
|
|
namespace Bit.Infrastructure.IntegrationTest.Repositories;
|
|
|
|
public class EmergencyAccessRepositoriesTests
|
|
{
|
|
[DatabaseTheory, DatabaseData]
|
|
public async Task DeleteAsync_UpdatesRevisionDate(IUserRepository userRepository,
|
|
IEmergencyAccessRepository emergencyAccessRepository,
|
|
ITestDatabaseHelper helper)
|
|
{
|
|
var grantorUser = await userRepository.CreateAsync(new User
|
|
{
|
|
Name = "Test Grantor User",
|
|
Email = "test+grantor@email.com",
|
|
ApiKey = "TEST",
|
|
SecurityStamp = "stamp",
|
|
});
|
|
|
|
var granteeUser = await userRepository.CreateAsync(new User
|
|
{
|
|
Name = "Test Grantee User",
|
|
Email = "test+grantee@email.com",
|
|
ApiKey = "TEST",
|
|
SecurityStamp = "stamp",
|
|
});
|
|
|
|
var emergencyAccess = await emergencyAccessRepository.CreateAsync(new EmergencyAccess
|
|
{
|
|
GrantorId = grantorUser.Id,
|
|
GranteeId = granteeUser.Id,
|
|
Status = EmergencyAccessStatusType.Confirmed,
|
|
});
|
|
|
|
helper.ClearTracker();
|
|
|
|
await emergencyAccessRepository.DeleteAsync(emergencyAccess);
|
|
|
|
var updatedGrantee = await userRepository.GetByIdAsync(granteeUser.Id);
|
|
|
|
Assert.NotEqual(updatedGrantee.AccountRevisionDate, granteeUser.AccountRevisionDate);
|
|
}
|
|
}
|