aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven-Hendrik Haase <svenstaro@gmail.com>2019-05-06 14:20:17 +0000
committerGitHub <noreply@github.com>2019-05-06 14:20:17 +0000
commit152c1c40a38f6c82e32a89755ff1ffd3127cac82 (patch)
tree530897653ef202f6d2e3ce131d0124d3284f25b9
parentMerge pull request #106 from KSXGitHub/cli-help-auth-add-detail (diff)
parentUse constant for assertion (diff)
downloadminiserve-152c1c40a38f6c82e32a89755ff1ffd3127cac82.tar.gz
miniserve-152c1c40a38f6c82e32a89755ff1ffd3127cac82.zip
Merge pull request #103 from KSXGitHub/test-auth-one-more-assertion
Add assertion of status code to auth_works
-rw-r--r--tests/auth.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/auth.rs b/tests/auth.rs
index 96cdcb5..0e5f9b7 100644
--- a/tests/auth.rs
+++ b/tests/auth.rs
@@ -44,11 +44,15 @@ fn auth_accepts(
sleep(Duration::from_secs(1));
let client = reqwest::Client::new();
- let body = client
+ let response = client
.get(format!("http://localhost:{}", port).as_str())
.basic_auth(client_username, Some(client_password))
- .send()?
- .error_for_status()?;
+ .send()?;
+
+ let status_code = response.status();
+ assert_eq!(status_code, StatusCode::OK);
+
+ let body = response.error_for_status()?;
let parsed = Document::from_read(body)?;
for &file in FILES {
assert!(parsed.find(Text).any(|x| x.text() == file));