1
0
mirror of https://github.com/bitwarden/server synced 2026-01-02 08:33:48 +00:00

fix(auth-validator): [PM-22975] Client Version Validator - Added more tests and added comment.

This commit is contained in:
Patrick Pimentel
2025-12-04 09:24:27 -05:00
parent f719763a85
commit cff2f5df6d
2 changed files with 42 additions and 0 deletions

View File

@@ -26,6 +26,43 @@ public class GetMinimumClientVersionForUserQueryTests
var version = await sut.Run(new User
{
SecurityVersion = 1,
PrivateKey = TestEncryptionConstants.V1EncryptedBase64,
});
Assert.Null(version);
}
[Fact]
public async Task Run_ReturnsNull_ForSecurityVersion1ButPrivateKeyV2User()
{
var sut = new GetMinimumClientVersionForUserQuery();
var version = await sut.Run(new User
{
SecurityVersion = 1,
PrivateKey = TestEncryptionConstants.V2PrivateKey,
});
Assert.Null(version);
}
[Fact]
public async Task Run_ReturnsNull_ForPrivateKeyV1ButSecurityVersion2User()
{
var sut = new GetMinimumClientVersionForUserQuery();
var version = await sut.Run(new User
{
SecurityVersion = 2,
PrivateKey = TestEncryptionConstants.V1EncryptedBase64,
});
Assert.Null(version);
}
[Fact]
public async Task Run_ReturnsNull_ForV1UserWithNull()
{
var sut = new GetMinimumClientVersionForUserQuery();
var version = await sut.Run(new User
{
SecurityVersion = null,
PrivateKey = TestEncryptionConstants.V2PrivateKey,
});
Assert.Null(version);