af3377a6bc
Finishes the lift of shared helpers into `tests/common/`. Covered: - health, web, oneliners_api, upload (31 tests; upload exercises the new `multipart_upload_body` helper driven by doctate_common field constants) - sse_integration, sse_cleanup, transcribe, oneliner_heal_decoupled, silent_case_empty, failed_only_case_empty_oneliner, transient_failure_retries (24 tests) Also applied cargo fmt across the test tree and fixed one clippy needless_borrows_for_generic_args warning in analyze_test. All 387 tests pass; 3 ignored (as before). Side effect: health_test previously used a hardcoded `/tmp/doctate-test` data path, which parallel `cargo test` runs could collide on. The migration replaces it with the common unique-tmpdir pattern, removing a latent flake.
41 lines
1.6 KiB
Rust
41 lines
1.6 KiB
Rust
//! Shared test-support helpers for `server/tests/*.rs`.
|
|
//!
|
|
//! Every integration test file under `tests/*.rs` is a standalone crate.
|
|
//! This module's special filename `mod.rs` prevents Cargo from
|
|
//! compiling it as its own test target — it is only loaded by test
|
|
//! files that opt in via `mod common;` at the top.
|
|
//!
|
|
//! `#[allow(dead_code)]` is applied because each test crate uses only
|
|
//! a subset of the helpers; without the allow, rustc emits a forest of
|
|
//! warnings for the unused ones in each crate.
|
|
|
|
#![allow(dead_code)]
|
|
// Re-exports below are visible to every test crate, but each crate only
|
|
// uses a subset — without the allow, rustc emits "unused import"
|
|
// warnings per crate. The helpers themselves are exercised; the
|
|
// warning is a false positive of the per-crate visibility model.
|
|
#![allow(unused_imports)]
|
|
|
|
pub mod config;
|
|
pub mod http;
|
|
pub mod paths;
|
|
pub mod seed;
|
|
pub mod session;
|
|
pub mod users;
|
|
|
|
// Re-exports for ergonomic `use common::*;` in most test files.
|
|
pub use config::{TestConfig, unique_tmpdir};
|
|
pub use http::{
|
|
body_bytes, body_json, body_string, csrf_form_post, form_post, get_with_api_key,
|
|
get_with_api_key_if_none_match, get_with_cookie, header_opt, header_str, multipart_upload_body,
|
|
};
|
|
pub use seed::{
|
|
past_rfc3339, seed_case, seed_oneliner_ready, seed_oneliner_state, seed_recording,
|
|
seed_recording_with_age, seed_recording_with_sidecars, write_closed_marker,
|
|
};
|
|
pub use session::{extract_session_cookie, login, login_request, login_with_csrf};
|
|
pub use users::{
|
|
TEST_BCRYPT_COST, TEST_PASSWORD, test_admin, test_user, test_user_with_password,
|
|
test_user_with_retention, test_user_with_window_hours,
|
|
};
|