From 132f637853f4cc980ea02355c6e091c24727a5ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Herbel?= Date: Tue, 19 Nov 2024 17:57:35 +0100 Subject: [PATCH] Add tests for ROBOCORP_HOME base CMK-20325 --- tests/test_scheduler.rs | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tests/test_scheduler.rs b/tests/test_scheduler.rs index 699113f7..ea221bb5 100644 --- a/tests/test_scheduler.rs +++ b/tests/test_scheduler.rs @@ -115,6 +115,12 @@ async fn test_scheduler() -> AnyhowResult<()> { .join("plans") .join(&config.plan_groups[0].plans[1].id), ); + assert_robocorp_home( + &config.rcc_config.robocorp_home_base, + #[cfg(windows)] + ¤t_user_name, + ) + .await?; Ok(()) } @@ -660,3 +666,35 @@ fn assert_sequentiality( dir_entries_second_plan.sort(); assert!(dir_entries_first_plan[0] < dir_entries_second_plan[0]); } + +async fn assert_robocorp_home( + robocorp_home_base: &Utf8Path, + #[cfg(windows)] headed_user_name: &str, +) -> AnyhowResult<()> { + assert!(robocorp_home_base.is_dir()); + assert_eq!( + directory_entries(robocorp_home_base, 1), + [ + "current_user", + #[cfg(windows)] + &format!("user_{headed_user_name}"), + ] + ); + #[cfg(windows)] + { + let permissions_robocorp_home_base = get_permissions(robocorp_home_base).await?; + assert_eq!( + permissions_robocorp_home_base + .lines() + .collect::>() + .len(), + 3 // Administrator group + empty line + success message (suppressing the latter with /q does not seem to work) + ); + assert!( + get_permissions(robocorp_home_base.join(format!("user_{headed_user_name}"))) + .await? + .contains(&format!("{headed_user_name}:(OI)(CI)(F)",)) + ); + } + Ok(()) +}