http_server_mock/verify
Assertion helpers for verifying that the mock server received the expected requests.
Each function accepts a running server and a RequestMatcher describing
which requests to count. On failure the functions panic with a descriptive
message that includes the matcher, the expected and actual counts, and a
list of all recorded requests.
verify.called_times(server, m, 1)
verify.never_called(server, other_matcher)
Values
pub fn called(
mock_server: @internal MockServer(http_server_mock.Started),
request_matcher: types.RequestMatcher,
) -> List(types.RecordedRequest)
Asserts that at least one recorded request matches request_matcher.
Returns the matching requests so you can chain further assertions. Panics with a descriptive message if no matching request was recorded.
pub fn called_at_least(
mock_server: @internal MockServer(http_server_mock.Started),
request_matcher: types.RequestMatcher,
count: Int,
) -> List(types.RecordedRequest)
Asserts that at least count recorded requests match request_matcher.
Returns the matching requests so you can chain further assertions.
Panics with a descriptive message if fewer than count requests matched.
pub fn called_times(
mock_server: @internal MockServer(http_server_mock.Started),
request_matcher: types.RequestMatcher,
count: Int,
) -> List(types.RecordedRequest)
Asserts that exactly count recorded requests match request_matcher.
Returns the matching requests so you can chain further assertions.
Panics with a descriptive message if the actual count differs from count.
pub fn never_called(
mock_server: @internal MockServer(http_server_mock.Started),
request_matcher: types.RequestMatcher,
) -> Nil
Asserts that no recorded request matches request_matcher.
Panics with a descriptive message (including the unexpected requests) if any matching request was recorded.