feat: test content rendering

This commit is contained in:
Aravinth Manivannan 2023-02-19 19:51:32 +05:30
parent fc371487fd
commit 511ee3819c
Signed by untrusted user: realaravinth
GPG key ID: AD9F0F08E855ED88
2 changed files with 484 additions and 0 deletions

View file

@ -281,6 +281,14 @@ mod tests {
assert_eq!(resp.status(), StatusCode::FOUND); assert_eq!(resp.status(), StatusCode::FOUND);
let headers = resp.headers(); let headers = resp.headers();
assert_eq!(headers.get(header::LOCATION).unwrap(), uri); assert_eq!(headers.get(header::LOCATION).unwrap(), uri);
let url = "/@tylerneely/fear-and-loathing-in-lock-free-programming-7158b1cdd50c";
let resp =
test::call_service(&app, test::TestRequest::get().uri(url).to_request()).await;
assert_eq!(resp.status(), StatusCode::OK);
let res = String::from_utf8(test::read_body(resp).await.to_vec()).unwrap();
assert!(res.contains(include_str!("../tests/7158b1cdd50c.html")));
} }
} }
} }

476
tests/7158b1cdd50c.html Normal file

File diff suppressed because one or more lines are too long