Fix test_parse_server_configuration

This commit is contained in:
Leonard Steppy 2025-02-07 13:03:22 +01:00
parent 89cd5232cf
commit d963d4ff88

View File

@ -806,8 +806,15 @@ mod test {
#[test]
fn test_parse_server_configuration() {
let servers = parse_server_configuration("foo:bar,.:fizz/buzz", || Ok(PathBuf::from("/test")))
.expect("valid server configuration");
//setup directory structure for test
let home_dir = PathBuf::from("target/test");
const LOCAL_SERVER_DIR: &str = "fizz/buzz";
fs::create_dir_all(home_dir.join(LOCAL_SERVER_DIR)).expect("failed to create server directory");
let servers = parse_server_configuration(&format!("foo:bar,.:{LOCAL_SERVER_DIR}"), || {
Ok(home_dir.clone())
})
.expect("valid server configuration");
assert_eq!(
vec![
Server {
@ -818,7 +825,10 @@ mod test {
},
Server {
address: ServerAddress::Localhost,
server_directory_path: PathBuf::from("/test/fizz/buzz"),
server_directory_path: home_dir
.join(LOCAL_SERVER_DIR)
.canonicalize()
.expect("home dir exists"),
}
],
servers