Introduce hagrid::web::tests::common::assert module. Move helper assertion fns there.

Changes:
- Move the following functions from hagrid::web::tests module to
  hagrid::web::tests::common::assert:
  - assert_consistency
  - check_maintenance
  - check_null_response
  - check_null_responses_by_email
  - check_responses_by_email
  - check_mr_response
  - check_index_response
  - check_mr_responses_by_fingerprint
  - check_response
  - check_hr_response
  - check_hr_response_onion
  - check_hr_responses_by_fingerprint
  - check_wkd_response
  - check_verify_link
  - check_verify_link_json
  - check_mails_and_verify_email
  - check_mails_and_confirm_deletion
  - pop_mail_capture_pattern
  - vks_publish_submit_multiple
  - vks_publish_submit_get_token
  - vks_publish_submit_response
  - vks_publish_shortcut_get_token
  - vks_publish_json_get_token
  - vks_manage
  - vks_manage_delete
- Change calls to these helper functions around the code accordingly.
This commit is contained in:
Zeke Fast
2025-09-08 00:51:56 +02:00
committed by Vincent Breitmoser
parent 76ec3eed82
commit d9741fad8f
2 changed files with 587 additions and 565 deletions

View File

@@ -182,7 +182,6 @@ pub fn key_to_hkp_index(db: &rocket::State<Sqlite>, i18n: I18n, query: Query) ->
#[cfg(test)]
mod tests {
use super::super::tests::*;
use ::rocket::local::blocking::Client;
use rstest::rstest;
@@ -248,14 +247,14 @@ mod tests {
assert!(upload_mail.is_none());
// We should not be able to look it up by email address.
check_null_responses_by_email(&client, cert_name);
assert::check_null_responses_by_email(&client, cert_name);
// And check that we can get it back via the machine readable
// interface.
check_mr_responses_by_fingerprint(&client, &tpk, 0);
assert::check_mr_responses_by_fingerprint(&client, &tpk, 0);
// And check that we can see the human-readable result page.
check_hr_responses_by_fingerprint(&client, &tpk, 0, base_uri);
assert::check_hr_responses_by_fingerprint(&client, &tpk, 0, base_uri);
// Upload the same key again, make sure the welcome mail is not sent again
let response = client
@@ -268,7 +267,7 @@ mod tests {
let welcome_mail = pop_mail(filemail_into.as_path()).unwrap();
assert!(welcome_mail.is_none());
assert_consistency(client.rocket());
assert::assert_consistency(client.rocket());
}
#[rstest]
@@ -330,11 +329,11 @@ mod tests {
let upload_mail_1 = pop_mail(filemail_into.as_path()).unwrap();
assert!(upload_mail_1.is_none());
check_mr_responses_by_fingerprint(&client, &tpk_0, 0);
check_mr_responses_by_fingerprint(&client, &tpk_1, 0);
check_hr_responses_by_fingerprint(&client, &tpk_0, 0, base_uri);
check_hr_responses_by_fingerprint(&client, &tpk_1, 0, base_uri);
assert::check_mr_responses_by_fingerprint(&client, &tpk_0, 0);
assert::check_mr_responses_by_fingerprint(&client, &tpk_1, 0);
assert::check_hr_responses_by_fingerprint(&client, &tpk_0, 0, base_uri);
assert::check_hr_responses_by_fingerprint(&client, &tpk_1, 0, base_uri);
assert_consistency(client.rocket());
assert::assert_consistency(client.rocket());
}
}

File diff suppressed because it is too large Load Diff