From 597074be99ea4de87d61cc17b3eeaa5111af6232 Mon Sep 17 00:00:00 2001 From: Enkidu93 Date: Wed, 27 Sep 2023 16:50:47 -0400 Subject: [PATCH] Make translation build config a property --- tests/Serval.E2ETests/ServalClientHelper.cs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tests/Serval.E2ETests/ServalClientHelper.cs b/tests/Serval.E2ETests/ServalClientHelper.cs index 2c1dbc3d..0eb0a0b8 100644 --- a/tests/Serval.E2ETests/ServalClientHelper.cs +++ b/tests/Serval.E2ETests/ServalClientHelper.cs @@ -8,11 +8,6 @@ public class ServalClientHelper readonly Dictionary EnginePerUser = new Dictionary(); private string _prefix; - public TranslationBuildConfig translationBuildConfig = new TranslationBuildConfig - { - Pretranslate = new List() - }; - public ServalClientHelper(string audience, string prefix = "SCE_", bool ignoreSSLErrors = false) { Dictionary env = GetEnvironment(); @@ -33,8 +28,11 @@ public ServalClientHelper(string audience, string prefix = "SCE_", bool ignoreSS $"Bearer {GetAuth0Authentication(env["authUrl"], audience, env["clientId"], env["clientSecret"]).Result}" ); _prefix = prefix; + TranslationBuildConfig = new TranslationBuildConfig { Pretranslate = new List() }; } + public TranslationBuildConfig TranslationBuildConfig { get; set; } + public static Dictionary GetEnvironment() { Dictionary env = @@ -82,7 +80,7 @@ public async Task ClearEngines(string name = "") await translationEnginesClient.DeleteAsync(translationEngine.Id); } } - translationBuildConfig.Pretranslate = new List(); + TranslationBuildConfig.Pretranslate = new List(); EnginePerUser.Clear(); } @@ -108,7 +106,7 @@ public async Task CreateNewEngine( public async Task StartBuildAsync(string engineId) { - return await translationEnginesClient.StartBuildAsync(engineId, translationBuildConfig); + return await translationEnginesClient.StartBuildAsync(engineId, TranslationBuildConfig); } public async Task BuildEngine(string engineId) @@ -205,7 +203,7 @@ bool pretranslate if (pretranslate) { - translationBuildConfig.Pretranslate!.Add( + TranslationBuildConfig.Pretranslate!.Add( new PretranslateCorpusConfig { CorpusId = response.Id, TextIds = filesToAdd.ToList() } ); }