pub struct FakeCustomHostnames { /* private fields */ }Expand description
An in-memory cratefield_core::CustomHostnames for module tests:
records every call, walks a claim from pending to live on demand, and
scripts the error the next call answers with.
create runs cratefield_core::check_hostname first, exactly as a
real adapter must, so a test can drive the Refused arm — the refusal
never reaches a provider.
Implementations§
Source§impl FakeCustomHostnames
impl FakeCustomHostnames
Sourcepub fn new(own_zone: impl Into<String>) -> Self
pub fn new(own_zone: impl Into<String>) -> Self
A fake serving hostnames outside own_zone — the zone whose names
are refused as the deployment’s own.
Sourcepub fn activate(&self, hostname: &str)
pub fn activate(&self, hostname: &str)
Walks a claim to Active/Active with no records left to publish.
A hostname that was never claimed is a no-op rather than a panic: a test’s setup failing should fail on the assertion, not here.
Sourcepub fn fail(&self, hostname: &str, reason: &str)
pub fn fail(&self, hostname: &str, reason: &str)
Records the claim as failed with the provider’s own reason.
Sourcepub fn refuse_next(&self, error: CustomHostnameError)
pub fn refuse_next(&self, error: CustomHostnameError)
Makes the next call answer error instead of its normal answer.
Queue several to script a sequence.
Trait Implementations§
Source§impl Clone for FakeCustomHostnames
impl Clone for FakeCustomHostnames
Source§impl CustomHostnames for FakeCustomHostnames
impl CustomHostnames for FakeCustomHostnames
Source§fn create<'life0, 'life1, 'async_trait>(
&'life0 self,
claim: &'life1 HostnameClaim,
) -> Pin<Box<dyn Future<Output = Result<CustomHostname, CustomHostnameError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create<'life0, 'life1, 'async_trait>(
&'life0 self,
claim: &'life1 HostnameClaim,
) -> Pin<Box<dyn Future<Output = Result<CustomHostname, CustomHostnameError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
claim.hostname with the provider and starts DV validation. Read moreSource§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
hostname: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<CustomHostname>, CustomHostnameError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
hostname: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<CustomHostname>, CustomHostnameError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Ok(None) when the provider has no such hostname. Read moreSource§fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
hostname: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), CustomHostnameError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
hostname: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), CustomHostnameError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Ok
(idempotent). Read more