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)