pub struct Mock { /* private fields */ }
Expand description
A testing server implementation of /blob.
Mock does not handle requests until instructed to do so.
Implementations§
Source§impl Mock
impl Mock
Sourcepub async fn expect_open_blob(&mut self, merkle: Hash) -> Blob
pub async fn expect_open_blob(&mut self, merkle: Hash) -> Blob
Consume the next directory request, verifying it is intended to read the blob identified
by merkle
. Returns a Blob
representing the open blob file.
§Panics
Panics on error or assertion violation (unexpected requests or a mismatched open call)
Sourcepub async fn expect_create_blob(&mut self, merkle: Hash) -> Blob
pub async fn expect_create_blob(&mut self, merkle: Hash) -> Blob
Consume the next directory request, verifying it is intended to create the blob identified
by merkle
. Returns a Blob
representing the open blob file.
§Panics
Panics on error or assertion violation (unexpected requests or a mismatched open call)
Sourcepub async fn expect_readdir(&mut self, entries: impl Iterator<Item = Hash>)
pub async fn expect_readdir(&mut self, entries: impl Iterator<Item = Hash>)
Consume directory requests, verifying they are requests to read directory entries. Respond with dirents constructed from the given entries.
§Panics
Panics on error or assertion violation (unexpected requests or not all entries are read)
Sourcepub async fn expect_readable_missing_checks(
&mut self,
readable: &[Hash],
missing: &[Hash],
)
pub async fn expect_readable_missing_checks( &mut self, readable: &[Hash], missing: &[Hash], )
Consume N directory requests, verifying they are intended to determine whether the blobs
specified readable
and missing
are readable or not, responding to the check based on
which collection the hash is in.
§Panics
Panics on error or assertion violation (unexpected requests, request for unspecified blob)
Sourcepub async fn expect_filter_to_missing_blobs_with_readable_missing_ids(
&mut self,
readable: &[Hash],
missing: &[Hash],
)
pub async fn expect_filter_to_missing_blobs_with_readable_missing_ids( &mut self, readable: &[Hash], missing: &[Hash], )
Expects and handles a call to [Client::filter_to_missing_blobs
].
Verifies the call intends to determine whether the blobs specified in readable
and
missing
are readable or not, responding to the check based on which collection the hash is
in.
§Panics
Panics on error or assertion violation (unexpected requests, request for unspecified blob)
Sourcepub async fn expect_done(self)
pub async fn expect_done(self)
Auto Trait Implementations§
impl Freeze for Mock
impl !RefUnwindSafe for Mock
impl Send for Mock
impl Sync for Mock
impl Unpin for Mock
impl !UnwindSafe for Mock
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
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more