Struct holochain::sweettest::SweetAgents
source · pub struct SweetAgents;
Expand description
Provides simple methods for generating collections of AgentPubKeys for use in tests
Implementations§
source§impl SweetAgents
impl SweetAgents
sourcepub fn stream(keystore: MetaLairClient) -> impl Stream<Item = AgentPubKey>
pub fn stream(keystore: MetaLairClient) -> impl Stream<Item = AgentPubKey>
Get an infinite stream of AgentPubKeys
sourcepub async fn get(keystore: MetaLairClient, num: usize) -> Vec<AgentPubKey> ⓘ
pub async fn get(keystore: MetaLairClient, num: usize) -> Vec<AgentPubKey> ⓘ
Get a Vec of AgentPubKeys
Examples found in repository?
src/sweettest/sweet_agents.rs (line 30)
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
pub async fn one(keystore: MetaLairClient) -> AgentPubKey {
let mut agents = Self::get(keystore, 1).await;
agents.pop().unwrap()
}
/// Get two AgentPubKeys
pub async fn two(keystore: MetaLairClient) -> (AgentPubKey, AgentPubKey) {
let mut agents = Self::get(keystore, 2).await;
(agents.pop().unwrap(), agents.pop().unwrap())
}
/// Get the same two AgentPubKeys every time
pub fn alice_and_bob() -> (AgentPubKey, AgentPubKey) {
(fake_agent_pubkey_1(), fake_agent_pubkey_2())
}
/// Get three AgentPubKeys
pub async fn three(keystore: MetaLairClient) -> (AgentPubKey, AgentPubKey, AgentPubKey) {
let mut agents = Self::get(keystore, 3).await;
(
agents.pop().unwrap(),
agents.pop().unwrap(),
agents.pop().unwrap(),
)
}
sourcepub async fn one(keystore: MetaLairClient) -> AgentPubKey
pub async fn one(keystore: MetaLairClient) -> AgentPubKey
Get one AgentPubKey
Examples found in repository?
src/sweettest/sweet_conductor.rs (line 312)
303 304 305 306 307 308 309 310 311 312 313 314 315
pub async fn setup_app<'a, R, D>(
&mut self,
installed_app_id: &str,
dnas: D,
) -> ConductorApiResult<SweetApp>
where
R: Into<DnaWithRole> + Clone + 'a,
D: IntoIterator<Item = &'a R> + Clone,
{
let agent = SweetAgents::one(self.keystore()).await;
self.setup_app_for_agent(installed_app_id, agent, dnas.clone())
.await
}
More examples
src/sweettest/sweet_conductor_batch.rs (line 72)
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
pub async fn setup_app(
&mut self,
installed_app_id: &str,
dna_files: &[DnaFile],
) -> ConductorApiResult<SweetAppBatch> {
let apps = self
.0
.iter_mut()
.map(|conductor| async move {
let agent = SweetAgents::one(conductor.keystore()).await;
conductor
.setup_app_for_agent(installed_app_id, agent, dna_files)
.await
})
.collect::<Vec<_>>();
Ok(future::join_all(apps)
.await
.into_iter()
.collect::<Result<Vec<_>, _>>()?
.into())
}
sourcepub async fn two(keystore: MetaLairClient) -> (AgentPubKey, AgentPubKey)
pub async fn two(keystore: MetaLairClient) -> (AgentPubKey, AgentPubKey)
Get two AgentPubKeys
sourcepub fn alice_and_bob() -> (AgentPubKey, AgentPubKey)
pub fn alice_and_bob() -> (AgentPubKey, AgentPubKey)
Get the same two AgentPubKeys every time
sourcepub async fn three(
keystore: MetaLairClient
) -> (AgentPubKey, AgentPubKey, AgentPubKey)
pub async fn three(
keystore: MetaLairClient
) -> (AgentPubKey, AgentPubKey, AgentPubKey)
Get three AgentPubKeys
Auto Trait Implementations§
impl RefUnwindSafe for SweetAgents
impl Send for SweetAgents
impl Sync for SweetAgents
impl Unpin for SweetAgents
impl UnwindSafe for SweetAgents
Blanket Implementations§
§impl<T> Any for Twhere
T: Any + ?Sized,
impl<T> Any for Twhere
T: Any + ?Sized,
§fn type_id_compat(&self) -> TypeId
fn type_id_compat(&self) -> TypeId
TODO: once 1.33.0 is the minimum supported compiler version, remove
Any::type_id_compat and use StdAny::type_id instead.
https://github.com/rust-lang/rust/issues/27745
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
§impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
§fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
Deserializes using the given deserializer
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.§impl<T> Upcastable for Twhere
T: 'static + Any + Send + Sync,
impl<T> Upcastable for Twhere
T: 'static + Any + Send + Sync,
§fn upcast_any_ref(&self) -> &(dyn Any + 'static)
fn upcast_any_ref(&self) -> &(dyn Any + 'static)
upcast ref
§fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)
upcast mut ref