macro_rules! assert_request_eq { ($mock_handle:expr, $expect:expr) => { ... }; ($mock_handle:expr, $expect:expr, $($arg:tt)*) => { ... }; }
Expand description
Asserts that the mock handle receives a new request equal to the given value.
On success, the SendResponse
handle for the matched request is returned,
allowing the caller to respond to the request. On failure, the macro panics.
ยงExamples
use tower_service::Service;
use tower_test::{mock, assert_request_eq};
use tokio_test::assert_ready;
let (mut service, mut handle) = mock::spawn();
assert_ready!(service.poll_ready());
let response = service.call("hello");
assert_request_eq!(handle, "hello").send_response("world");
assert_eq!(response.await.unwrap(), "world");