Update tests

This commit is contained in:
Jonas Platte
2021-11-29 14:30:45 +01:00
parent dfd59f42a9
commit 5824cb649e
5 changed files with 19 additions and 16 deletions

View File

@@ -1146,9 +1146,9 @@ impl BaseClient {
/// ```
/// # use std::convert::TryFrom;
/// # use matrix_sdk_base::BaseClient;
/// # use ruma::UserId;
/// # use ruma::{device_id, user_id};
/// # use futures::executor::block_on;
/// # let alice = Box::<UserId>::try_from("@alice:example.org").unwrap();
/// # let alice = user_id!("@alice:example.org").to_owned();
/// # let client = BaseClient::new().unwrap();
/// # block_on(async {
/// let device = client.get_device(&alice, device_id!("DEVICEID")).await;

View File

@@ -20,7 +20,10 @@ The state machine works in a push/pull manner:
use std::{collections::BTreeMap, convert::TryFrom};
use matrix_sdk_crypto::{OlmMachine, OlmError};
use ruma::{UserId, api::client::r0::sync::sync_events::{ToDevice, DeviceLists}};
use ruma::{
api::client::r0::sync::sync_events::{ToDevice, DeviceLists},
device_id, UserId,
};
#[tokio::main]
async fn main() -> Result<(), OlmError> {

View File

@@ -76,7 +76,7 @@ pub enum KeyExportError {
/// ```no_run
/// # use std::io::Cursor;
/// # use matrix_sdk_crypto::{OlmMachine, decrypt_key_export};
/// # use ruma::user_id;
/// # use ruma::{device_id, user_id};
/// # use futures::executor::block_on;
/// # let alice = user_id!("@alice:example.org");
/// # let machine = OlmMachine::new(&alice, device_id!("DEVICEID"));
@@ -127,13 +127,13 @@ pub fn decrypt_key_export(
/// # Examples
/// ```no_run
/// # use matrix_sdk_crypto::{OlmMachine, encrypt_key_export};
/// # use ruma::{user_id, room_id};
/// # use ruma::{device_id, user_id, room_id};
/// # use futures::executor::block_on;
/// # let alice = user_id!("@alice:example.org");
/// # let machine = OlmMachine::new(&alice, device_id!("DEVICEID"));
/// # block_on(async {
/// let room_id = room_id!("!test:localhost");
/// let exported_keys = machine.export_keys(|s| s.room_id() == &room_id).await.unwrap();
/// let exported_keys = machine.export_keys(|s| s.room_id() == room_id).await.unwrap();
/// let encrypted_export = encrypt_key_export(&exported_keys, "1234", 1);
/// # });
/// ```

View File

@@ -1224,9 +1224,9 @@ impl OlmMachine {
/// ```
/// # use std::convert::TryFrom;
/// # use matrix_sdk_crypto::OlmMachine;
/// # use ruma::UserId;
/// # use ruma::{device_id, user_id};
/// # use futures::executor::block_on;
/// # let alice = Box::<UserId>::try_from("@alice:example.org").unwrap();
/// # let alice = user_id!("@alice:example.org").to_owned();
/// # let machine = OlmMachine::new(&alice, device_id!("DEVICEID"));
/// # block_on(async {
/// let device = machine.get_device(&alice, device_id!("DEVICEID")).await;
@@ -1265,9 +1265,9 @@ impl OlmMachine {
/// ```
/// # use std::convert::TryFrom;
/// # use matrix_sdk_crypto::OlmMachine;
/// # use ruma::UserId;
/// # use ruma::{device_id, user_id};
/// # use futures::executor::block_on;
/// # let alice = Box::<UserId>::try_from("@alice:example.org").unwrap();
/// # let alice = user_id!("@alice:example.org").to_owned();
/// # let machine = OlmMachine::new(&alice, device_id!("DEVICEID"));
/// # block_on(async {
/// let devices = machine.get_user_devices(&alice).await.unwrap();
@@ -1301,7 +1301,7 @@ impl OlmMachine {
/// ```no_run
/// # use std::io::Cursor;
/// # use matrix_sdk_crypto::{OlmMachine, decrypt_key_export};
/// # use ruma::user_id;
/// # use ruma::{device_id, user_id};
/// # use futures::executor::block_on;
/// # let alice = user_id!("@alice:example.org");
/// # let machine = OlmMachine::new(&alice, device_id!("DEVICEID"));
@@ -1413,13 +1413,13 @@ impl OlmMachine {
///
/// ```no_run
/// # use matrix_sdk_crypto::{OlmMachine, encrypt_key_export};
/// # use ruma::{user_id, room_id};
/// # use ruma::{device_id, user_id, room_id};
/// # use futures::executor::block_on;
/// # let alice = user_id!("@alice:example.org");
/// # let machine = OlmMachine::new(&alice, device_id!("DEVICEID"));
/// # block_on(async {
/// let room_id = room_id!("!test:localhost");
/// let exported_keys = machine.export_keys(|s| s.room_id() == &room_id).await.unwrap();
/// let exported_keys = machine.export_keys(|s| s.room_id() == room_id).await.unwrap();
/// let encrypted_export = encrypt_key_export(&exported_keys, "1234", 1);
/// # });
/// ```

View File

@@ -26,9 +26,9 @@
//! # OlmMachine,
//! # store::MemoryStore,
//! # };
//! # use ruma::{user_id, DeviceId};
//! # let user_id = user_id!("@example:localhost");
//! # let device_id: Box<DeviceId> = device_id!("TEST");
//! # use ruma::{device_id, user_id};
//! # let user_id = user_id!("@example:localhost").to_owned();
//! # let device_id = device_id!("TEST").to_owned();
//! let store = Box::new(MemoryStore::new());
//!
//! let machine = OlmMachine::new_with_store(user_id, device_id, store);