add tests for symbolically linked files & directories

trying to reproduce issue #60
This commit is contained in:
Johann150 2021-06-06 10:49:20 +02:00
parent f890de24f6
commit 14e15d430a
No known key found for this signature in database
GPG key ID: 9EE6577A2A06F8F1
4 changed files with 63 additions and 0 deletions

View file

@ -145,6 +145,66 @@ fn index_page() {
);
}
#[test]
/// - symlinked files are followed correctly
fn symlink_page() {
let page = get(
&["--addr", "[::]:1986"],
addr(1986),
"gemini://localhost/symlink.gmi",
)
.expect("could not get page");
assert_eq!(
page.header,
Header {
status: Status::Success,
meta: "text/gemini".to_string(),
}
);
assert_eq!(
page.body,
Some(
std::fs::read_to_string(concat!(
env!("CARGO_MANIFEST_DIR"),
"/tests/data/content/index.gmi"
))
.unwrap()
)
);
}
#[test]
/// - symlinked directories are followed correctly
fn symlink_directory() {
let page = get(
&["--addr", "[::]:1987"],
addr(1987),
"gemini://localhost/symlinked_dir/file.gmi",
)
.expect("could not get page");
assert_eq!(
page.header,
Header {
status: Status::Success,
meta: "text/gemini".to_string(),
}
);
assert_eq!(
page.body,
Some(
std::fs::read_to_string(concat!(
env!("CARGO_MANIFEST_DIR"),
"/tests/data/symlinked_dir/file.gmi"
))
.unwrap()
)
);
}
#[test]
/// - the `--addr` configuration works
/// - MIME media types can be set in the configuration file