pub struct Fake { /* private fields */ }Expand description
A script of URL patterns to responses, plus a record of what was asked.
Implementations§
Source§impl Fake
impl Fake
pub fn new() -> Self
Sourcepub fn on(self, pattern: &str, response: FakeResponse) -> Self
pub fn on(self, pattern: &str, response: FakeResponse) -> Self
Answer any URL containing pattern, or matching it with a * wildcard.
Sourcepub fn fallback(self, response: FakeResponse) -> Self
pub fn fallback(self, response: FakeResponse) -> Self
Answer anything not matched above. Without this, an unexpected request is an error — a test should not silently pass because a call went somewhere nobody scripted.
pub fn count(&self) -> usize
pub fn assert_sent(&self, pattern: &str)
pub fn assert_not_sent(&self, pattern: &str)
pub fn assert_count(&self, expected: usize)
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Fake
impl RefUnwindSafe for Fake
impl Send for Fake
impl Sync for Fake
impl Unpin for Fake
impl UnsafeUnpin for Fake
impl UnwindSafe for Fake
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