fix(release): withhold unqualified CV review and record gates
This commit is contained in:
@@ -54,12 +54,12 @@ public sealed class CvAiReadinessTests
|
||||
|
||||
public Task<CvAiProposal> Generate(string? context = null, string target = "section:summary") =>
|
||||
Suggestions.GenerateAsync("owner", Cv.Id, 1, target, "improve", Source, context, "Rewrite supported facts only.", default);
|
||||
public CvVariantController Controller()
|
||||
public CvVariantController Controller(bool reviewAvailable = true)
|
||||
{
|
||||
var user = new ApplicationUser { Id = "owner" };
|
||||
var users = TestHostFactory.CreateUserManager(user);
|
||||
users.Setup(value => value.GetUserAsync(It.IsAny<ClaimsPrincipal>())).ReturnsAsync(user);
|
||||
return new(users.Object, Variants, Mock.Of<ICvPdfExporter>(), Ai.Object, suggestions: Suggestions)
|
||||
return new(users.Object, Variants, Mock.Of<ICvPdfExporter>(), Ai.Object, suggestions: reviewAvailable ? Suggestions : null)
|
||||
{ ControllerContext = new() { HttpContext = new DefaultHttpContext
|
||||
{ User = new ClaimsPrincipal(new ClaimsIdentity(new[] { new Claim(ClaimTypes.NameIdentifier, "owner") }, "local")) } } };
|
||||
}
|
||||
@@ -283,6 +283,22 @@ public sealed class CvAiReadinessTests
|
||||
await fixture.AssertUnchanged();
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(false)]
|
||||
[InlineData(true)]
|
||||
public async Task Unavailable_review_service_blocks_generation_and_apply_without_side_effects(bool apply)
|
||||
{
|
||||
await using var fixture = new Fixture(); await fixture.Open();
|
||||
var controller = fixture.Controller(reviewAvailable: false);
|
||||
var response = apply
|
||||
? Assert.IsType<ObjectResult>((await controller.ApplyAi(fixture.Cv.Id, new("unused-proposal", Paraphrase), default)).Result)
|
||||
: Assert.IsType<ObjectResult>((await controller.AiAssist(new("improve", Source, null, null, "en", fixture.Cv.Id, 1, "section:summary"), default)).Result);
|
||||
Assert.Equal(503, response.StatusCode);
|
||||
Assert.Equal("cv_ai_unavailable", JsonSerializer.SerializeToElement(response.Value).GetProperty("code").GetString());
|
||||
fixture.Ai.VerifyNoOtherCalls();
|
||||
await fixture.AssertUnchanged();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Confirmed_provider_fabrication_reproduction_is_now_an_API_rejection()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user