mirror of
https://github.com/sigoden/dufs.git
synced 2026-04-09 00:59:02 +03:00
test: add integration tests (#36)
This commit is contained in:
30
tests/path_prefix.rs
Normal file
30
tests/path_prefix.rs
Normal file
@@ -0,0 +1,30 @@
|
||||
mod fixtures;
|
||||
mod utils;
|
||||
|
||||
use fixtures::{server, Error, TestServer};
|
||||
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"))?;
|
||||
assert_index_resp!(resp);
|
||||
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(())
|
||||
}
|
||||
Reference in New Issue
Block a user