fix up the tests

main
_ 2022-04-20 12:25:44 +00:00
parent daec2b3887
commit c2299ab39a
2 changed files with 12 additions and 6 deletions

View File

@ -67,7 +67,13 @@ fn file_server () {
let rt = Runtime::new ().expect ("Can't create runtime"); let rt = Runtime::new ().expect ("Can't create runtime");
rt.block_on (async { rt.block_on (async {
let file_server_root = PathBuf::from ("./"); let files_root = PathBuf::from ("./");
let dirs_roots = Default::default ();
let file_server_root = internal::FileRoots {
files: &files_root,
dirs: &dirs_roots,
};
let headers = Default::default (); let headers = Default::default ();
{ {
@ -100,7 +106,7 @@ fn file_server () {
})), })),
] { ] {
let resp = internal::serve_all ( let resp = internal::serve_all (
&file_server_root, file_server_root,
Method::Get, Method::Get,
uri_path, uri_path,
&headers, &headers,
@ -117,7 +123,7 @@ fn file_server () {
}), }),
] { ] {
let resp = internal::serve_all ( let resp = internal::serve_all (
&file_server_root, file_server_root,
Method::Get, Method::Get,
uri_path, uri_path,
&headers, &headers,
@ -128,7 +134,7 @@ fn file_server () {
} }
let resp = internal::serve_all ( let resp = internal::serve_all (
&file_server_root, file_server_root,
Method::Get, Method::Get,
bad_passwords_path, bad_passwords_path,
&hashmap! { &hashmap! {
@ -140,7 +146,7 @@ fn file_server () {
assert_eq! (resp.expect ("Should be Ok (_)"), RangeNotSatisfiable (1_048_576)); assert_eq! (resp.expect ("Should be Ok (_)"), RangeNotSatisfiable (1_048_576));
let resp = internal::serve_all ( let resp = internal::serve_all (
&file_server_root, file_server_root,
Method::Head, Method::Head,
bad_passwords_path, bad_passwords_path,
&headers, &headers,

View File

@ -151,7 +151,7 @@ impl TestingServer {
let (stop_tx, stop_rx) = oneshot::channel (); let (stop_tx, stop_rx) = oneshot::channel ();
let task = { let task = {
spawn (async move { spawn (async move {
ptth_server::run_server (config_file, stop_rx, None, None).await ptth_server::run_server (config_file, stop_rx, None, None, None).await
}) })
}; };