Module verification

Module verification 

Source
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§

VerificationRequest
Pattern for matching requests during verification
VerificationResult
Result of a verification operation

Enums§

VerificationCount
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