Skip to content

Commit

Permalink
Make translation build config a property
Browse files Browse the repository at this point in the history
  • Loading branch information
Enkidu93 committed Sep 27, 2023
1 parent 3f84743 commit 597074b
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions tests/Serval.E2ETests/ServalClientHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ public class ServalClientHelper
readonly Dictionary<string, string> EnginePerUser = new Dictionary<string, string>();
private string _prefix;

public TranslationBuildConfig translationBuildConfig = new TranslationBuildConfig
{
Pretranslate = new List<PretranslateCorpusConfig>()
};

public ServalClientHelper(string audience, string prefix = "SCE_", bool ignoreSSLErrors = false)
{
Dictionary<string, string> env = GetEnvironment();
Expand All @@ -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<PretranslateCorpusConfig>() };
}

public TranslationBuildConfig TranslationBuildConfig { get; set; }

public static Dictionary<string, string> GetEnvironment()
{
Dictionary<string, string> env =
Expand Down Expand Up @@ -82,7 +80,7 @@ public async Task ClearEngines(string name = "")
await translationEnginesClient.DeleteAsync(translationEngine.Id);
}
}
translationBuildConfig.Pretranslate = new List<PretranslateCorpusConfig>();
TranslationBuildConfig.Pretranslate = new List<PretranslateCorpusConfig>();
EnginePerUser.Clear();
}

Expand All @@ -108,7 +106,7 @@ public async Task<string> CreateNewEngine(

public async Task<TranslationBuild> StartBuildAsync(string engineId)
{
return await translationEnginesClient.StartBuildAsync(engineId, translationBuildConfig);
return await translationEnginesClient.StartBuildAsync(engineId, TranslationBuildConfig);
}

public async Task BuildEngine(string engineId)
Expand Down Expand Up @@ -205,7 +203,7 @@ bool pretranslate

if (pretranslate)
{
translationBuildConfig.Pretranslate!.Add(
TranslationBuildConfig.Pretranslate!.Add(
new PretranslateCorpusConfig { CorpusId = response.Id, TextIds = filesToAdd.ToList() }
);
}
Expand Down

0 comments on commit 597074b

Please sign in to comment.