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 fail_create(&mut self, merkle: Hash, e: CreateBlobError)
pub async fn fail_create(&mut self, merkle: Hash, e: CreateBlobError)
Consume the next BlobCreator request, verifying it is intended to create the blob identified
by merkle. Fail the request with e.
§Panics
Panics on error or assertion violation (unexpected requests or a mismatched open call)
Sourcepub async fn expect_create_blob(&mut self, merkle: Hash) -> BlobWriter
pub async fn expect_create_blob(&mut self, merkle: Hash) -> BlobWriter
Consume the next BlobCreator request, verifying it is intended to create the blob identified
by merkle. Return a BlobWriter for validating the writes.
§Panics
Panics on error or assertion violation (unexpected requests or a mismatched open call)
Sourcepub async fn expect_open_blob(
&mut self,
merkle: Hash,
res: Result<Vec<u8>, Status>,
)
pub async fn expect_open_blob( &mut self, merkle: Hash, res: Result<Vec<u8>, Status>, )
Consume the next BlobReader request, verifying it is intended to open the blob identified
by merkle. Either serve the contents of res.ok() or fail the open with res.err().
§Panics
Panics on error or assertion violation (unexpected requests or a mismatched open call)
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,
§impl<T> InstanceFromServiceTransport<T> for T
impl<T> InstanceFromServiceTransport<T> for T
§fn from_service_transport(handle: T) -> T
fn from_service_transport(handle: T) -> T
T to [Self]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