mirror of
https://gitlab.com/keys.openpgp.org/hagrid.git
synced 2025-10-06 00:23:08 +02:00
Move hagrid::web::tests::common::assert::check_maintenance() helper to hagrid::routes::tests::common::assert::maintenance::check_maintenance().
Additional changes: - Adjust imports and usages accordingly.
This commit is contained in:
committed by
Vincent Breitmoser
parent
3ce6e8b495
commit
63a4445c9f
@@ -244,6 +244,23 @@ pub mod tests {
|
||||
println!("{body}");
|
||||
assert!(!body.contains(absent_page_text));
|
||||
}
|
||||
|
||||
pub mod maintenance {
|
||||
use super::*;
|
||||
|
||||
pub fn check_maintenance(
|
||||
response: LocalResponse,
|
||||
content_type: ContentType,
|
||||
maintenance_text: &str,
|
||||
) {
|
||||
super::response(
|
||||
response,
|
||||
Status::ServiceUnavailable,
|
||||
content_type,
|
||||
maintenance_text,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -324,19 +324,6 @@ pub mod tests {
|
||||
use std::path::Path;
|
||||
use std::time::SystemTime;
|
||||
|
||||
pub fn check_maintenance(
|
||||
response: LocalResponse,
|
||||
content_type: ContentType,
|
||||
maintenance_text: &str,
|
||||
) {
|
||||
crate::routes::tests::common::assert::response(
|
||||
response,
|
||||
Status::ServiceUnavailable,
|
||||
content_type,
|
||||
maintenance_text,
|
||||
);
|
||||
}
|
||||
|
||||
/// Asserts that the given URI 404s.
|
||||
pub fn check_null_response(client: &Client, uri: &str) {
|
||||
let response = client.get(uri).dispatch();
|
||||
@@ -832,39 +819,39 @@ pub mod tests {
|
||||
file.write_all(maintenance_text.as_bytes()).unwrap();
|
||||
|
||||
// Check that endpoints return a maintenance message
|
||||
common::assert::check_maintenance(
|
||||
assert::maintenance::check_maintenance(
|
||||
client.get("/upload").dispatch(),
|
||||
ContentType::HTML,
|
||||
maintenance_text,
|
||||
);
|
||||
common::assert::check_maintenance(
|
||||
assert::maintenance::check_maintenance(
|
||||
client.get("/manage").dispatch(),
|
||||
ContentType::HTML,
|
||||
maintenance_text,
|
||||
);
|
||||
common::assert::check_maintenance(
|
||||
assert::maintenance::check_maintenance(
|
||||
client.get("/verify").dispatch(),
|
||||
ContentType::HTML,
|
||||
maintenance_text,
|
||||
);
|
||||
common::assert::check_maintenance(
|
||||
assert::maintenance::check_maintenance(
|
||||
client.get("/pks/add").dispatch(),
|
||||
ContentType::Plain,
|
||||
maintenance_text,
|
||||
);
|
||||
common::assert::check_maintenance(
|
||||
assert::maintenance::check_maintenance(
|
||||
client.get("/vks/v1/upload").dispatch(),
|
||||
ContentType::JSON,
|
||||
maintenance_text,
|
||||
);
|
||||
common::assert::check_maintenance(
|
||||
assert::maintenance::check_maintenance(
|
||||
client.get("/vks/v1/request-verify").dispatch(),
|
||||
ContentType::JSON,
|
||||
maintenance_text,
|
||||
);
|
||||
|
||||
// Extra check for the shortcut "PUT" endpoint
|
||||
common::assert::check_maintenance(
|
||||
assert::maintenance::check_maintenance(
|
||||
client.put("/").dispatch(),
|
||||
ContentType::Plain,
|
||||
maintenance_text,
|
||||
|
Reference in New Issue
Block a user