matrix-sdk: Move the EventBuilder into a separate crate so it can be reused.
parent
d32172f74e
commit
207fac2b49
|
@ -2,6 +2,7 @@
|
||||||
members = [
|
members = [
|
||||||
"matrix_sdk",
|
"matrix_sdk",
|
||||||
"matrix_sdk_base",
|
"matrix_sdk_base",
|
||||||
|
"matrix_sdk_test",
|
||||||
"matrix_sdk_crypto",
|
"matrix_sdk_crypto",
|
||||||
"matrix_sdk_common",
|
"matrix_sdk_common",
|
||||||
]
|
]
|
||||||
|
|
|
@ -45,6 +45,7 @@ default-features = false
|
||||||
features = ["sync", "time", "fs"]
|
features = ["sync", "time", "fs"]
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
matrix-sdk-test = { version = "0.1.0", path = "../matrix_sdk_test" }
|
||||||
tokio = { version = "0.2.20", features = ["rt-threaded", "macros"] }
|
tokio = { version = "0.2.20", features = ["rt-threaded", "macros"] }
|
||||||
ruma-identifiers = { version = "0.16.1", features = ["rand"] }
|
ruma-identifiers = { version = "0.16.1", features = ["rand"] }
|
||||||
serde_json = "1.0.52"
|
serde_json = "1.0.52"
|
||||||
|
|
|
@ -37,9 +37,6 @@ mod models;
|
||||||
mod session;
|
mod session;
|
||||||
mod state;
|
mod state;
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
pub mod test_builder;
|
|
||||||
|
|
||||||
pub use base_client::{Client, RoomState, RoomStateType};
|
pub use base_client::{Client, RoomState, RoomStateType};
|
||||||
pub use event_emitter::EventEmitter;
|
pub use event_emitter::EventEmitter;
|
||||||
#[cfg(feature = "encryption")]
|
#[cfg(feature = "encryption")]
|
||||||
|
|
|
@ -524,8 +524,8 @@ mod test {
|
||||||
use crate::api::r0::sync::sync_events::Response as SyncResponse;
|
use crate::api::r0::sync::sync_events::Response as SyncResponse;
|
||||||
use crate::events::room::member::MembershipState;
|
use crate::events::room::member::MembershipState;
|
||||||
use crate::identifiers::UserId;
|
use crate::identifiers::UserId;
|
||||||
use crate::test_builder::EventBuilder;
|
|
||||||
use crate::{Client, Session};
|
use crate::{Client, Session};
|
||||||
|
use matrix_sdk_test::EventBuilder;
|
||||||
|
|
||||||
use http::Response;
|
use http::Response;
|
||||||
|
|
||||||
|
|
|
@ -199,10 +199,11 @@ impl RoomMember {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
|
use matrix_sdk_test::EventBuilder;
|
||||||
|
|
||||||
use crate::events::collections::all::RoomEvent;
|
use crate::events::collections::all::RoomEvent;
|
||||||
use crate::events::room::member::MembershipState;
|
use crate::events::room::member::MembershipState;
|
||||||
use crate::identifiers::{RoomId, UserId};
|
use crate::identifiers::{RoomId, UserId};
|
||||||
use crate::test_builder::EventBuilder;
|
|
||||||
use crate::{Client, Session};
|
use crate::{Client, Session};
|
||||||
|
|
||||||
use crate::js_int::Int;
|
use crate::js_int::Int;
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
[package]
|
||||||
|
authors = ["Damir Jelić <poljar@termina.org.uk"]
|
||||||
|
description = "Helpers to write tests for the Matrix SDK"
|
||||||
|
edition = "2018"
|
||||||
|
homepage = "https://github.com/matrix-org/matrix-rust-sdk"
|
||||||
|
keywords = ["matrix", "chat", "messaging", "ruma"]
|
||||||
|
license = "Apache-2.0"
|
||||||
|
name = "matrix-sdk-test"
|
||||||
|
readme = "README.md"
|
||||||
|
repository = "https://github.com/matrix-org/matrix-rust-sdk"
|
||||||
|
version = "0.1.0"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
serde_json = "1.0.52"
|
||||||
|
http = "*"
|
||||||
|
matrix-sdk-common = { version = "0.1.0", path = "../matrix_sdk_common" }
|
|
@ -1,11 +1,12 @@
|
||||||
#![cfg(test)]
|
use std::convert::TryFrom;
|
||||||
|
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::panic;
|
use std::panic;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
use crate::api::r0::sync::sync_events::Response as SyncResponse;
|
use http::Response;
|
||||||
use crate::events::{
|
|
||||||
|
use matrix_sdk_common::api::r0::sync::sync_events::Response as SyncResponse;
|
||||||
|
use matrix_sdk_common::events::{
|
||||||
collections::{
|
collections::{
|
||||||
all::{RoomEvent, StateEvent},
|
all::{RoomEvent, StateEvent},
|
||||||
only::Event,
|
only::Event,
|
||||||
|
@ -13,8 +14,6 @@ use crate::events::{
|
||||||
presence::PresenceEvent,
|
presence::PresenceEvent,
|
||||||
EventJson, TryFromRaw,
|
EventJson, TryFromRaw,
|
||||||
};
|
};
|
||||||
use http::Response;
|
|
||||||
use std::convert::TryFrom;
|
|
||||||
|
|
||||||
/// Easily create events to stream into either a Client or a `Room` for testing.
|
/// Easily create events to stream into either a Client or a `Room` for testing.
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
Loading…
Reference in New Issue