diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2025-06-22 22:57:08 +0200 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2025-06-22 22:57:08 +0200 |
| commit | f9b7c2a14c939d0bb7d1ac2fcca3116e38e37f74 (patch) | |
| tree | cc20775f2d70416ef6414d265b7e1d44cce6fece /server/tests/integration_test.rs | |
| parent | 9cb8a56b406c46244e936c2f40830d0e89dba785 (diff) | |
Add support for pushing changes to a translation review
Finally got around to fixing the pre-receive hook to include quarantined
objects so the hook actually can run git commands on the not-yet-accepted
commits. As part of that, had to make sure git hook and eyeballs server
had the same path to the repo or confusion will appear.
Diffstat (limited to 'server/tests/integration_test.rs')
| -rw-r--r-- | server/tests/integration_test.rs | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/server/tests/integration_test.rs b/server/tests/integration_test.rs index 40804df..03180cd 100644 --- a/server/tests/integration_test.rs +++ b/server/tests/integration_test.rs @@ -160,6 +160,8 @@ async fn test_translation_review_create(ctx: &mut common::DockerComposeContext) .await .expect("create translation review"); + // Check that all strings are unchanged, no change pushed yet + for _ in 0..5 { let strings = common::list_translation_strings(ctx, &mut client1, review.id) .await @@ -228,4 +230,99 @@ async fn test_translation_review_create(ctx: &mut common::DockerComposeContext) } sleep(Duration::from_millis(500)); } + + ctx.git_clone("client1").await.expect("git clone user01"); + { + let dir = ctx.git_dir("client1"); + ctx.git_cmd("client1", &["config", "set", "user.name", "John Smith"]) + .await + .expect("config set"); + ctx.git_cmd( + "client1", + &["config", "set", "user.email", "user01@example.org"], + ) + .await + .expect("config set"); + fs::write( + dir.join("translations/strings_sv.xlf"), + common::STRINGS_SV_XLF.replace("Primära teststrängen", "Primära test strängen"), + ) + .await + .expect("update strings_sv.xlf"); + ctx.git_cmd("client1", &["add", "translations/strings_sv.xlf"]) + .await + .expect("git add"); + ctx.git_cmd("client1", &["commit", "-m", "Update Swedish translation"]) + .await + .expect("git commit"); + ctx.git_cmd( + "client1", + &["push", "origin", format!("HEAD:t/{}", review.id).as_str()], + ) + .await + .expect("git push"); + } + + let strings = common::list_translation_strings(ctx, &mut client1, review.id) + .await + .expect("list strings"); + assert_eq!( + strings.strings, + vec![ + api_model::LocalizationString { + id: "EXTRA_STRING".to_string(), + file: "extra.grdp".to_string(), + description: "Some description".to_string(), + meaning: "".to_string(), + source: "Extra string, gray".to_string(), + placeholders: vec![], + placeholder_offset: vec![], + translations: vec![ + api_model::TranslationString { + language: "en-gb".to_string(), + translation: "Extra string, grey".to_string(), + placeholder_offset: vec![], + state: api_model::TranslationState::Unchanged, + comment: "".to_string(), + reviewer: None, + }, + api_model::TranslationString { + language: "sv".to_string(), + translation: "Extra sträng, grå".to_string(), + placeholder_offset: vec![], + state: api_model::TranslationState::Unchanged, + comment: "".to_string(), + reviewer: None, + } + ], + }, + api_model::LocalizationString { + id: "MAIN_STRING".to_string(), + file: "strings.grd".to_string(), + description: "Description".to_string(), + meaning: "".to_string(), + source: "Main test string".to_string(), + placeholders: vec![], + placeholder_offset: vec![], + translations: vec![ + api_model::TranslationString { + language: "en-gb".to_string(), + translation: "Main test string".to_string(), + placeholder_offset: vec![], + state: api_model::TranslationState::Unchanged, + comment: "".to_string(), + reviewer: None, + }, + api_model::TranslationString { + language: "sv".to_string(), + translation: "Primära test strängen".to_string(), + placeholder_offset: vec![], + state: api_model::TranslationState::Unreviewed, + comment: "".to_string(), + reviewer: None, + } + ], + }, + ] + ); } |
