From d1f1ff93c7d667614bf50e877eb1eef7eed9132a Mon Sep 17 00:00:00 2001 From: Sven-Hendrik Haase Date: Sun, 28 Mar 2021 21:44:52 +0200 Subject: Fix tests --- tests/serve_request.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tests/serve_request.rs') diff --git a/tests/serve_request.rs b/tests/serve_request.rs index 95449f5..6477bc2 100644 --- a/tests/serve_request.rs +++ b/tests/serve_request.rs @@ -185,17 +185,18 @@ fn serves_requests_custom_index_notice(tmpdir: TempDir, port: u16) -> Result<(), .arg(port.to_string()) .arg(tmpdir.path()) .stdout(Stdio::piped()) + .stderr(Stdio::piped()) .spawn()?; sleep(Duration::from_secs(1)); child.kill()?; let output = child.wait_with_output().expect("Failed to read stdout"); - let all_text = String::from_utf8(output.stdout); + let all_text = String::from_utf8(output.stderr); assert!(all_text .unwrap() - .contains("The provided index file could not be found")); + .contains("The file 'not.html' provided for option --index could not be found.")); Ok(()) } -- cgit v1.2.3 From 58f40d8314821624ab55aa45493cedd407ee0376 Mon Sep 17 00:00:00 2001 From: Ali MJ Al-Nasrawy Date: Tue, 6 Apr 2021 20:16:59 +0300 Subject: Test URL encoding for special characters --- tests/serve_request.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests/serve_request.rs') diff --git a/tests/serve_request.rs b/tests/serve_request.rs index 6477bc2..25c5574 100644 --- a/tests/serve_request.rs +++ b/tests/serve_request.rs @@ -49,6 +49,12 @@ fn serves_requests_with_non_default_port(tmpdir: TempDir, port: u16) -> Result<( for &file in FILES { let f = parsed.find(|x: &Node| x.text() == file).next().unwrap(); + reqwest::blocking::get(format!( + "http://localhost:{}/{}", + port, + f.attr("href").unwrap() + ))? + .error_for_status()?; assert_eq!( format!("/{}", file), percent_encoding::percent_decode_str(f.attr("href").unwrap()).decode_utf8_lossy(), -- cgit v1.2.3