Expand description
Request verification API for MockForge
This module provides WireMock-style programmatic verification of requests, allowing test code to verify that specific requests were made (or not made) with various count assertions.
§Example
use mockforge_core::verification::{VerificationRequest, VerificationCount, verify_requests};
use mockforge_core::request_logger::get_global_logger;
// Verify that GET /api/users was called exactly 3 times
let pattern = VerificationRequest {
method: Some("GET".to_string()),
path: Some("/api/users".to_string()),
query_params: std::collections::HashMap::new(),
headers: std::collections::HashMap::new(),
body_pattern: None,
};
let logger = get_global_logger().unwrap();
let result = verify_requests(logger, &pattern, VerificationCount::Exactly(3)).await;
assert!(result.matched, "Expected GET /api/users to be called exactly 3 times");Structs§
- Verification
Request - Pattern for matching requests during verification
- Verification
Result - Result of a verification operation
Enums§
- Verification
Count - Count assertion for verification
Functions§
- matches_
verification_ pattern - Check if a request log entry matches the verification pattern
- verify_
at_ least - Verify that a request was made at least N times
- verify_
never - Verify that a request was never made
- verify_
requests - Verify requests against a pattern and count assertion
- verify_
sequence - Verify that requests occurred in a specific sequence