pub struct FakePrivacyProvider { /* private fields */ }Expand description
An in-memory external provider. Construct with its signing secret, hold
sections per subject (with_subject), and assert on
what it saw (calls, applies,
holds).
Implementations§
Source§impl FakePrivacyProvider
impl FakePrivacyProvider
Sourcepub fn new(secret: impl Into<String>) -> Self
pub fn new(secret: impl Into<String>) -> Self
A provider that signs with secret. A module configured with a
different one has every call refused with 401.
Sourcepub fn with_subject(&self, subject: &str, sections: Value) -> Self
pub fn with_subject(&self, subject: &str, sections: Value) -> Self
Holds sections (the sections array a real provider answers
/export with) for subject.
Sourcepub fn retain_section(&self, section: &str, reason: &str) -> Self
pub fn retain_section(&self, section: &str, reason: &str) -> Self
Plans section as retain rather than delete, with reason.
Sourcepub fn set_failure(&self, status: u16, body: &str)
pub fn set_failure(&self, status: u16, body: &str)
Answers every call with status and body, after authentication.
Sourcepub fn calls(&self) -> Vec<ProviderCall>
pub fn calls(&self) -> Vec<ProviderCall>
Every authenticated call, in order.
Sourcepub fn applies(&self, request_id: &str) -> usize
pub fn applies(&self, request_id: &str) -> usize
How many times request_id effectively applied: 1 after the first
apply, still 1 after a retry or a re-POST of the same confirm.
Sourcepub fn signature_failures(&self) -> usize
pub fn signature_failures(&self) -> usize
How many calls arrived with a signature this provider refused.
Trait Implementations§
Source§impl Clone for FakePrivacyProvider
impl Clone for FakePrivacyProvider
Source§impl Default for FakePrivacyProvider
impl Default for FakePrivacyProvider
Source§impl HttpClient for FakePrivacyProvider
impl HttpClient for FakePrivacyProvider
Source§fn send<'life0, 'async_trait>(
&'life0 self,
request: Request<Bytes>,
) -> Pin<Box<dyn Future<Output = Result<Response<Bytes>, HttpError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send<'life0, 'async_trait>(
&'life0 self,
request: Request<Bytes>,
) -> Pin<Box<dyn Future<Output = Result<Response<Bytes>, HttpError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sends
request and returns the fully-buffered response under the
bounds this port carries: the body is at most
MAX_RESPONSE_BYTES unless an HttpPolicy tightens it, the
exchange is bounded by that policy’s deadline
(enforced through BoundedHttpClient on runtimes that wrap),
the destination is vetted where real sockets are opened, and a
runtime that keeps a concurrency budget holds one for the send. Read moreSource§fn send_streaming<'life0, 'async_trait>(
&'life0 self,
request: Request<Bytes>,
) -> Pin<Box<dyn Future<Output = Result<Response<Pin<Box<dyn Stream<Item = Result<Bytes, HttpError>> + Send>>>, HttpError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn send_streaming<'life0, 'async_trait>(
&'life0 self,
request: Request<Bytes>,
) -> Pin<Box<dyn Future<Output = Result<Response<Pin<Box<dyn Stream<Item = Result<Bytes, HttpError>> + Send>>>, HttpError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Sends
request and returns the response with its body as a
stream (issue #859): the status and headers are known when the
future resolves — the head is bounded by HttpPolicy::timeout,
the same deadline send answers under — and the bytes arrive chunk
by chunk afterwards, under the StreamPolicy the request carries. Read moreAuto Trait Implementations§
impl Freeze for FakePrivacyProvider
impl RefUnwindSafe for FakePrivacyProvider
impl Send for FakePrivacyProvider
impl Sync for FakePrivacyProvider
impl Unpin for FakePrivacyProvider
impl UnsafeUnpin for FakePrivacyProvider
impl UnwindSafe for FakePrivacyProvider
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