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] #[test]
fn test_parse_server_configuration() { fn test_parse_server_configuration() {
let servers = parse_server_configuration("foo:bar,.:fizz/buzz", || Ok(PathBuf::from("/test"))) //setup directory structure for test
.expect("valid server configuration"); 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!( assert_eq!(
vec![ vec![
Server { Server {
@ -818,7 +825,10 @@ mod test {
}, },
Server { Server {
address: ServerAddress::Localhost, 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 servers