2022-07-06 07:11:00 +03:00
|
|
|
//! Run file server with different args
|
|
|
|
|
2022-06-12 03:43:50 +03:00
|
|
|
mod fixtures;
|
|
|
|
mod utils;
|
|
|
|
|
2022-07-08 14:30:05 +03:00
|
|
|
use fixtures::{server, Error, TestServer};
|
2022-06-12 03:43:50 +03:00
|
|
|
use rstest::rstest;
|
|
|
|
|
|
|
|
#[rstest]
|
|
|
|
fn path_prefix_index(#[with(&["--path-prefix", "xyz"])] server: TestServer) -> Result<(), Error> {
|
|
|
|
let resp = reqwest::blocking::get(format!("{}{}", server.url(), "xyz"))?;
|
2022-06-25 03:15:16 +03:00
|
|
|
assert_resp_paths!(resp);
|
2022-06-12 03:43:50 +03:00
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
#[rstest]
|
|
|
|
fn path_prefix_file(#[with(&["--path-prefix", "xyz"])] server: TestServer) -> Result<(), Error> {
|
|
|
|
let resp = reqwest::blocking::get(format!("{}{}/index.html", server.url(), "xyz"))?;
|
|
|
|
assert_eq!(resp.status(), 200);
|
|
|
|
assert_eq!(resp.text()?, "This is index.html");
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
#[rstest]
|
|
|
|
fn path_prefix_propfind(
|
|
|
|
#[with(&["--path-prefix", "xyz"])] server: TestServer,
|
|
|
|
) -> Result<(), Error> {
|
|
|
|
let resp = fetch!(b"PROPFIND", format!("{}{}", server.url(), "xyz")).send()?;
|
|
|
|
let text = resp.text()?;
|
|
|
|
assert!(text.contains("<D:href>/xyz/</D:href>"));
|
|
|
|
Ok(())
|
|
|
|
}
|