Skip to content

Commit

Permalink
Fix typo in endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Enkidu93 committed Oct 8, 2024
1 parent d097cbd commit 195b70b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 19 deletions.
22 changes: 8 additions & 14 deletions src/Serval/src/Serval.Client/Client.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4337,11 +4337,11 @@ public partial interface ITranslationEnginesClient
/// Will completely replace corpus' file associations. Will not affect jobs already queued or running. Will not affect existing pretranslations until new build is complete.
/// </remarks>
/// <param name="id">The translation engine id</param>
/// <param name="corpusConfig">The corpus configuration</param>
/// <param name="parallelCorpusId">The corpus id</param>
/// <param name="corpusConfig">The corpus configuration</param>
/// <returns>The corpus was updated successfully</returns>
/// <exception cref="ServalApiException">A server side error occurred.</exception>
System.Threading.Tasks.Task<TranslationCorpus> UpdateParallelCorpusAsync(string id, TranslationParallelCorpusUpdateConfig corpusConfig, string corpusId, string? parallelCorpusId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
System.Threading.Tasks.Task<TranslationCorpus> UpdateParallelCorpusAsync(string id, string parallelCorpusId, TranslationParallelCorpusUpdateConfig corpusConfig, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));

/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <summary>
Expand Down Expand Up @@ -6376,17 +6376,17 @@ public string BaseUrl
/// Will completely replace corpus' file associations. Will not affect jobs already queued or running. Will not affect existing pretranslations until new build is complete.
/// </remarks>
/// <param name="id">The translation engine id</param>
/// <param name="corpusConfig">The corpus configuration</param>
/// <param name="parallelCorpusId">The corpus id</param>
/// <param name="corpusConfig">The corpus configuration</param>
/// <returns>The corpus was updated successfully</returns>
/// <exception cref="ServalApiException">A server side error occurred.</exception>
public virtual async System.Threading.Tasks.Task<TranslationCorpus> UpdateParallelCorpusAsync(string id, TranslationParallelCorpusUpdateConfig corpusConfig, string corpusId, string? parallelCorpusId = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
public virtual async System.Threading.Tasks.Task<TranslationCorpus> UpdateParallelCorpusAsync(string id, string parallelCorpusId, TranslationParallelCorpusUpdateConfig corpusConfig, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
if (id == null)
throw new System.ArgumentNullException("id");

if (corpusId == null)
throw new System.ArgumentNullException("corpusId");
if (parallelCorpusId == null)
throw new System.ArgumentNullException("parallelCorpusId");

if (corpusConfig == null)
throw new System.ArgumentNullException("corpusConfig");
Expand All @@ -6406,17 +6406,11 @@ public string BaseUrl

var urlBuilder_ = new System.Text.StringBuilder();
if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl);
// Operation Path: "translation/engines/{id}/parallel-corpora/{corpusId}"
// Operation Path: "translation/engines/{id}/parallel-corpora/{parallelCorpusId}"
urlBuilder_.Append("translation/engines/");
urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture)));
urlBuilder_.Append("/parallel-corpora/");
urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(corpusId, System.Globalization.CultureInfo.InvariantCulture)));
urlBuilder_.Append('?');
if (parallelCorpusId != null)
{
urlBuilder_.Append(System.Uri.EscapeDataString("parallelCorpusId")).Append('=').Append(System.Uri.EscapeDataString(ConvertToString(parallelCorpusId, System.Globalization.CultureInfo.InvariantCulture))).Append('&');
}
urlBuilder_.Length--;
urlBuilder_.Append(System.Uri.EscapeDataString(ConvertToString(parallelCorpusId, System.Globalization.CultureInfo.InvariantCulture)));

PrepareRequest(client_, request_, urlBuilder_);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ CancellationToken cancellationToken
/// <response code="404">The engine or corpus does not exist.</response>
/// <response code="503">A necessary service is currently unavailable. Check `/health` for more details.</response>
[Authorize(Scopes.UpdateTranslationEngines)]
[HttpPatch("{id}/parallel-corpora/{corpusId}")]
[HttpPatch("{id}/parallel-corpora/{parallelCorpusId}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(typeof(void), StatusCodes.Status400BadRequest)]
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -645,8 +645,8 @@ string engineId
Assert.That(engine, Is.Not.Null);
Assert.Multiple(() =>

Check failure on line 646 in src/Serval/test/Serval.ApiServer.IntegrationTests/TranslationEngineTests.cs

View workflow job for this annotation

GitHub Actions / NUnit Tests

Serval.ApiServer.TranslationEngineTests ► UpdateCorpusByIdForEngineByIdAsync(["update:translation_engines", "create:translation_engines", "read:translation_engines"],200,"e00000000000000000000001")

Failed test found in: src/Serval/test/Serval.ApiServer.IntegrationTests/TestResults/test-results.trx Error: Multiple failures or warnings in test: 1) Assert.That(engine.Corpora[0].SourceFiles[0].Filename, Is.EqualTo(FILE1_FILENAME)) String lengths are both 6. Strings differ at index 5. Expected: "file_a" But was: "file_b" ----------------^ 2) Assert.That(engine.Corpora[0].TargetFiles[0].Filename, Is.EqualTo(FILE2_FILENAME)) String lengths are both 6. Strings differ at index 5. Expected: "file_b" But was: "file_a" ----------------^
Raw output
Multiple failures or warnings in test:
  1)   Assert.That(engine.Corpora[0].SourceFiles[0].Filename, Is.EqualTo(FILE1_FILENAME))
  String lengths are both 6. Strings differ at index 5.
  Expected: "file_a"
  But was:  "file_b"
  ----------------^

  2)   Assert.That(engine.Corpora[0].TargetFiles[0].Filename, Is.EqualTo(FILE2_FILENAME))
  String lengths are both 6. Strings differ at index 5.
  Expected: "file_b"
  But was:  "file_a"
  ----------------^


   at Serval.ApiServer.TranslationEngineTests.UpdateCorpusByIdForEngineByIdAsync(IEnumerable`1 scope, Int32 expectedStatusCode, String engineId) in /home/runner/work/serval/serval/src/Serval/test/Serval.ApiServer.IntegrationTests/TranslationEngineTests.cs:line 646
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await[TResult](Func`1 invoke)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.BeforeAndAfterTestCommand.<>c__DisplayClass1_0.<Execute>b__0()
   at NUnit.Framework.Internal.Commands.DelegatingTestCommand.RunTestMethodInThreadAbortSafeZone(TestExecutionContext context, Action action)

1)    at Serval.ApiServer.TranslationEngineTests.<>c__DisplayClass32_1.<UpdateCorpusByIdForEngineByIdAsync>b__1() in /home/runner/work/serval/serval/src/Serval/test/Serval.ApiServer.IntegrationTests/TranslationEngineTests.cs:line 648
   at NUnit.Framework.Assert.Multiple(TestDelegate testDelegate)
   at Serval.ApiServer.TranslationEngineTests.UpdateCorpusByIdForEngineByIdAsync(IEnumerable`1 scope, Int32 expectedStatusCode, String engineId) in /home/runner/work/serval/serval/src/Serval/test/Serval.ApiServer.IntegrationTests/TranslationEngineTests.cs:line 646

2)    at Serval.ApiServer.TranslationEngineTests.<>c__DisplayClass32_1.<UpdateCorpusByIdForEngineByIdAsync>b__1() in /home/runner/work/serval/serval/src/Serval/test/Serval.ApiServer.IntegrationTests/TranslationEngineTests.cs:line 649
   at NUnit.Framework.Assert.Multiple(TestDelegate testDelegate)
   at Serval.ApiServer.TranslationEngineTests.UpdateCorpusByIdForEngineByIdAsync(IEnumerable`1 scope, Int32 expectedStatusCode, String engineId) in /home/runner/work/serval/serval/src/Serval/test/Serval.ApiServer.IntegrationTests/TranslationEngineTests.cs:line 646

{
Assert.That(engine.Corpora[0].SourceFiles[0].Filename, Is.EqualTo(FILE2_FILENAME));
Assert.That(engine.Corpora[0].TargetFiles[0].Filename, Is.EqualTo(FILE1_FILENAME));
Assert.That(engine.Corpora[0].SourceFiles[0].Filename, Is.EqualTo(FILE1_FILENAME));
Assert.That(engine.Corpora[0].TargetFiles[0].Filename, Is.EqualTo(FILE2_FILENAME));
});
break;
}
Expand Down Expand Up @@ -891,7 +891,7 @@ string engineId
SourceCorpusIds = [SOURCE_CORPUS_ID],
TargetCorpusIds = [TARGET_CORPUS_ID]
};
await client.UpdateParallelCorpusAsync(engineId, updateConfig, result.Id);
await client.UpdateParallelCorpusAsync(engineId, result.Id, updateConfig);
Engine? engine = await _env.Engines.GetAsync(engineId);
Assert.That(engine, Is.Not.Null);
Assert.Multiple(() =>
Expand All @@ -917,7 +917,7 @@ string engineId
SourceCorpusIds = [SOURCE_CORPUS_ID],
TargetCorpusIds = [TARGET_CORPUS_ID]
};
await client.UpdateParallelCorpusAsync(engineId, updateConfig, DOES_NOT_EXIST_CORPUS_ID);
await client.UpdateParallelCorpusAsync(engineId, DOES_NOT_EXIST_CORPUS_ID, updateConfig);
});
Assert.That(ex?.StatusCode, Is.EqualTo(expectedStatusCode));
break;
Expand Down

0 comments on commit 195b70b

Please sign in to comment.