Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
va-an authored and the10thWiz committed Jun 26, 2024
1 parent 80844f2 commit a3c2bce
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions examples/templating/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,20 @@ fn test_404(base: &str) {
let client = Client::tracked(rocket()).unwrap();
for bad_path in &["/hello", "/foo/bar", "/404"] {
let path = format!("/{}{}", base, bad_path);
let escaped_path = RawStr::new(&path).html_escape();

let escaped_path_upper = RawStr::new(&path).html_escape();
let escaped_path_lower = escaped_path_upper.to_lowercase();

let response = client.get(&path).dispatch();
assert_eq!(response.status(), Status::NotFound);
let response = response.into_string().unwrap();

assert!(response.contains(base));
assert! {
response.contains(&format!("{} does not exist", path))
|| response.contains(&format!("{} does not exist", escaped_path))
};
assert!(response.contains(base));
assert!(
response.contains(&format!("{} does not exist", path)) ||
response.contains(&format!("{} does not exist", escaped_path_upper)) ||
response.contains(&format!("{} does not exist", escaped_path_lower))
);
}
}

Expand Down Expand Up @@ -89,6 +92,6 @@ fn tera() {
fn minijinja() {
test_root("minijinja");
test_name("minijinja");
// test_404("minijinja"); // FIXME: in progress
test_404("minijinja");
test_about("minijinja");
}

0 comments on commit a3c2bce

Please sign in to comment.