pub struct ExchangeAssert { /* private fields */ }Expand description
A handle for making synchronous assertions on a recorded exchange.
Obtain one via MockEndpointInner::exchange after calling
MockEndpointInner::await_exchanges.
All methods panic with descriptive messages on failure, making test output self-explanatory without additional context.
Implementations§
Source§impl ExchangeAssert
impl ExchangeAssert
Sourcepub fn assert_body_text(self, expected: &str) -> Self
pub fn assert_body_text(self, expected: &str) -> Self
Assert that the body is Body::Text equal to expected.
Sourcepub fn assert_body_json(self, expected: Value) -> Self
pub fn assert_body_json(self, expected: Value) -> Self
Assert that the body is Body::Json equal to expected.
Sourcepub fn assert_body_bytes(self, expected: &[u8]) -> Self
pub fn assert_body_bytes(self, expected: &[u8]) -> Self
Assert that the body is Body::Bytes equal to expected.
Sourcepub fn assert_header(self, key: &str, expected: Value) -> Self
pub fn assert_header(self, key: &str, expected: Value) -> Self
Assert that header key exists and equals expected.
§Panics
Panics if the header is missing or its value does not match expected.
Sourcepub fn assert_header_exists(self, key: &str) -> Self
pub fn assert_header_exists(self, key: &str) -> Self
Sourcepub fn assert_has_error(self) -> Self
pub fn assert_has_error(self) -> Self
Assert that the exchange has an error (exchange.error is Some).
§Panics
Panics if exchange.error is None.
Sourcepub fn assert_no_error(self) -> Self
pub fn assert_no_error(self) -> Self
Assert that the exchange has no error (exchange.error is None).
§Panics
Panics if exchange.error is Some.
Auto Trait Implementations§
impl !Freeze for ExchangeAssert
impl !RefUnwindSafe for ExchangeAssert
impl Send for ExchangeAssert
impl Sync for ExchangeAssert
impl Unpin for ExchangeAssert
impl UnsafeUnpin for ExchangeAssert
impl !UnwindSafe for ExchangeAssert
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more