pub trait ConformanceBackend: ChatBackend {
// Required methods
fn caller(&self, account_id: &Id) -> Self::CallerCtx;
fn add_account(
&self,
account_id: &Id,
owner_user_id: &str,
) -> impl Future<Output = ()> + Send;
fn seed(
&self,
account_id: &Id,
type_name: &'static str,
object: Value,
) -> impl Future<Output = ()> + Send;
fn take_outbound_events(&self) -> Option<Vec<OutboundEvent>>;
}testkit only.Expand description
The test seam a ChatBackend implements to run the conformance
suite.
The methods stand in for what a deployment does outside the JMAP methods: provisioning an account, authenticating its owner, and storing objects that arrived by federation or were created server-side.
Required Methods§
Sourcefn caller(&self, account_id: &Id) -> Self::CallerCtx
fn caller(&self, account_id: &Id) -> Self::CallerCtx
The caller context of a request made by the owner of
account_id.
The ChatStore::create_object authorisation contract applies:
the backend must let this caller act as the owner of account_id.
Sourcefn add_account(
&self,
account_id: &Id,
owner_user_id: &str,
) -> impl Future<Output = ()> + Send
fn add_account( &self, account_id: &Id, owner_user_id: &str, ) -> impl Future<Output = ()> + Send
Provision account_id, owned by owner_user_id (the ownerUserId
Session field, as returned by ChatSettings::owner_user_id), so
JmapAccounts::account_exists
reports it and it holds no objects.
Sourcefn seed(
&self,
account_id: &Id,
type_name: &'static str,
object: Value,
) -> impl Future<Output = ()> + Send
fn seed( &self, account_id: &Id, type_name: &'static str, object: Value, ) -> impl Future<Output = ()> + Send
Store object, the wire JSON of a type_name object (for example
"Message"), in account_id exactly as given, under the id in its
id member, replacing any object stored under that id.
Fixtures use this for objects no client method creates (received
Messages, ChatContacts, PresenceStatus) and for fields no client
may set. The suite reads state before and after the writes it
tests, so whether seeding advances the state does not matter.
Objects may omit properties that have a default.
Sourcefn take_outbound_events(&self) -> Option<Vec<OutboundEvent>>
fn take_outbound_events(&self) -> Option<Vec<OutboundEvent>>
Drain the OutboundEvents the backend has enqueued since the
last call, oldest first.
Return None when the backend cannot observe its own outbound
queue; the tests that check events then pass without running.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl ConformanceBackend for MemoryBackend<()>
memory only.impl ConformanceBackend for MemoryBackend<Id>
memory only.