Move case for "GET /" (landing_page_is_visible) of hagrid::web::tests::basics() test to hagrid::routes::index::tests::get_root module.

This commit is contained in:
Zeke Fast
2025-09-08 11:32:38 +02:00
committed by Vincent Breitmoser
parent 74c25c9d9b
commit 090a6f222a
2 changed files with 29 additions and 1 deletions

View File

@@ -6,3 +6,32 @@ use rocket_i18n::I18n;
pub fn root(origin: RequestOrigin, i18n: I18n) -> MyResponse {
MyResponse::ok_bare("index", i18n, origin)
}
#[cfg(test)]
mod tests {
use crate::web::tests::common::*;
use ::rocket::http::{ContentType, Status};
use ::rocket::local::blocking::Client;
use rstest::rstest;
use tempfile::TempDir;
mod get_root {
use super::*;
#[rstest]
#[case::landing_page_is_visible("/", Status::Ok, ContentType::HTML, "Hagrid")]
fn basics(
#[from(client)] (_tmpdir, client): (TempDir, Client),
#[case] uri: &str,
#[case] status: Status,
#[case] content_type: ContentType,
#[case] page_text: &'static str,
) {
let response = client.get(uri).dispatch();
assert_eq!(response.status(), status);
assert_eq!(response.content_type(), Some(content_type));
assert!(response.into_string().unwrap().contains(page_text));
}
}
}

View File

@@ -969,7 +969,6 @@ pub mod tests {
}
#[rstest]
#[case::landing_page_is_visible("/", Status::Ok, ContentType::HTML, "Hagrid")]
#[case::privacy_policy_is_visible(
"/about",
Status::Ok,