Хелпер Support/TestCiphers.New: детерминированная семантика enc:base64 через Returns-лямбды. Потребители (8 файлов) перетипизированы на ISecretCipher, фейк удалён, тесты 1340 зелёные.
This commit is contained in:
@@ -5,6 +5,7 @@ using Deal.Infrastructure.Integrations.Exceptions;
|
||||
using Deal.Infrastructure.Integrations.Models;
|
||||
using Deal.Infrastructure.Integrations.Options;
|
||||
using Deal.Infrastructure.Integrations.Services;
|
||||
using Deal.Modules.Settings.Application.Abstractions;
|
||||
using Deal.Modules.Settings.Application.Models;
|
||||
using Deal.Modules.Tenants.Application.Services;
|
||||
using Deal.SharedKernel.Tenants.Models;
|
||||
@@ -39,7 +40,7 @@ public sealed class GrpcAiToolsTests
|
||||
reply.Keywords.Add("telegram каналы");
|
||||
service.GenerateKeywordsReply = reply;
|
||||
FakeSettingsStore settings = new();
|
||||
FakeSecretCipher cipher = new();
|
||||
ISecretCipher cipher = TestCiphers.New();
|
||||
FakeTenantLimitStore limits = new();
|
||||
|
||||
IAiTools tools = CreateTools(port, settings, cipher, limits);
|
||||
@@ -65,7 +66,7 @@ public sealed class GrpcAiToolsTests
|
||||
await AiGrpcTestHost.RunAsync(AiGrpcTestHost.DefaultToken, new RecordingAiService(), async (port, service) =>
|
||||
{
|
||||
service.KeywordsUnavailable = true;
|
||||
IAiTools tools = CreateTools(port, new FakeSettingsStore(), new FakeSecretCipher());
|
||||
IAiTools tools = CreateTools(port, new FakeSettingsStore(), TestCiphers.New());
|
||||
|
||||
AiGenerateKeywordsResultDto result = await tools.GenerateKeywordsAsync("описание", CancellationToken.None);
|
||||
|
||||
@@ -88,7 +89,7 @@ public sealed class GrpcAiToolsTests
|
||||
Usage = new Usage { Prompt = 200, Completion = 10, Total = 210 },
|
||||
};
|
||||
FakeTenantLimitStore limits = new();
|
||||
IAiTools tools = CreateTools(port, new FakeSettingsStore(), new FakeSecretCipher(), limits);
|
||||
IAiTools tools = CreateTools(port, new FakeSettingsStore(), TestCiphers.New(), limits);
|
||||
|
||||
AiEvaluateFitResultDto result = await tools.EvaluateFitAsync(
|
||||
"Ищу дизайнера для лендинга", "Разработка сайтов на Python", new[] { "python", "бэкенд" }, CancellationToken.None);
|
||||
@@ -112,7 +113,7 @@ public sealed class GrpcAiToolsTests
|
||||
await AiGrpcTestHost.RunAsync(AiGrpcTestHost.DefaultToken, new RecordingAiService(), async (port, service) =>
|
||||
{
|
||||
service.FitUnavailable = true;
|
||||
IAiTools tools = CreateTools(port, new FakeSettingsStore(), new FakeSecretCipher());
|
||||
IAiTools tools = CreateTools(port, new FakeSettingsStore(), TestCiphers.New());
|
||||
|
||||
await Assert.ThrowsAsync<AiUnavailableException>(
|
||||
() => tools.EvaluateFitAsync("текст", "описание", new[] { "ключ" }, CancellationToken.None));
|
||||
@@ -128,7 +129,7 @@ public sealed class GrpcAiToolsTests
|
||||
private static GrpcAiTools CreateTools(
|
||||
int port,
|
||||
FakeSettingsStore settings,
|
||||
FakeSecretCipher cipher,
|
||||
ISecretCipher cipher,
|
||||
FakeTenantLimitStore? limits = null)
|
||||
{
|
||||
ITenantContext tenantContext = new TenantContext();
|
||||
|
||||
Reference in New Issue
Block a user