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

test(auth-validator): [PM-22975] Client Version Validator - Fixed the last test.

This commit is contained in:
Patrick Pimentel
2025-12-02 16:42:09 -05:00
parent 6696104e9d
commit aa4f8ab96e
2 changed files with 17 additions and 7 deletions

View File

@@ -25,6 +25,7 @@ public class IdentityApplicationFactory : WebApplicationFactoryBase<Startup>
public const string DefaultDeviceIdentifier = "92b9d953-b9b6-4eaf-9d3e-11d57144dfeb";
public const string DefaultUserEmail = "DefaultEmail@bitwarden.com";
public const string DefaultUserPasswordHash = "default_password_hash";
public bool UseMockClientVersionValidator { get; set; } = true;
/// <summary>
/// A dictionary to store registration tokens for email verification. We cannot substitute the IMailService more than once, so
@@ -48,12 +49,15 @@ public class IdentityApplicationFactory : WebApplicationFactoryBase<Startup>
});
});
// Bypass client version gating to isolate tests from client version behavior
SubstituteService<IClientVersionValidator>(svc =>
if (UseMockClientVersionValidator)
{
svc.ValidateAsync(Arg.Any<User>(), Arg.Any<CustomValidatorRequestContext>())
.Returns(Task.FromResult(true));
});
// Bypass client version gating to isolate tests from client version behavior
SubstituteService<IClientVersionValidator>(svc =>
{
svc.ValidateAsync(Arg.Any<User>(), Arg.Any<CustomValidatorRequestContext>())
.Returns(Task.FromResult(true));
});
}
base.ConfigureWebHost(builder);
}