testing: Move ALICE, BOB, CAROL statics to test crate

This commit is contained in:
Jonas Platte
2023-09-21 12:41:22 +02:00
committed by Jonas Platte
parent a5a9940ad9
commit 5d5f5e18de
14 changed files with 37 additions and 39 deletions
@@ -16,7 +16,7 @@ use assert_matches::assert_matches;
use eyeball_im::VectorDiff;
use imbl::vector;
use matrix_sdk_base::deserialized_responses::SyncTimelineEvent;
use matrix_sdk_test::{async_test, sync_timeline_event};
use matrix_sdk_test::{async_test, sync_timeline_event, ALICE, BOB, CAROL};
use ruma::{
assign,
events::{
@@ -32,9 +32,9 @@ use ruma::{
};
use stream_assert::assert_next_matches;
use super::{TestTimeline, ALICE, BOB};
use super::TestTimeline;
use crate::timeline::{
event_item::AnyOtherFullStateEventContent, tests::CAROL, MembershipChange, TimelineDetails,
event_item::AnyOtherFullStateEventContent, MembershipChange, TimelineDetails,
TimelineItemContent, TimelineItemKind, VirtualTimelineItem,
};
@@ -17,14 +17,14 @@ use std::{io, sync::Arc};
use assert_matches::assert_matches;
use eyeball_im::VectorDiff;
use matrix_sdk::Error;
use matrix_sdk_test::{async_test, sync_timeline_event};
use matrix_sdk_test::{async_test, sync_timeline_event, ALICE, BOB};
use ruma::{
event_id,
events::{room::message::RoomMessageEventContent, AnyMessageLikeEventContent},
};
use stream_assert::assert_next_matches;
use super::{TestTimeline, ALICE, BOB};
use super::TestTimeline;
use crate::timeline::event_item::EventSendState;
#[async_test]
@@ -14,7 +14,7 @@
use assert_matches::assert_matches;
use eyeball_im::VectorDiff;
use matrix_sdk_test::{async_test, sync_timeline_event};
use matrix_sdk_test::{async_test, sync_timeline_event, ALICE};
use ruma::{
assign,
events::{
@@ -27,7 +27,7 @@ use ruma::{
};
use stream_assert::assert_next_matches;
use super::{TestTimeline, ALICE};
use super::TestTimeline;
use crate::timeline::TimelineItemContent;
#[async_test]
@@ -19,7 +19,7 @@ use std::{io::Cursor, iter};
use assert_matches::assert_matches;
use eyeball_im::VectorDiff;
use matrix_sdk::crypto::{decrypt_room_key_export, OlmMachine};
use matrix_sdk_test::async_test;
use matrix_sdk_test::{async_test, BOB};
use ruma::{
assign,
events::room::encrypted::{
@@ -30,7 +30,7 @@ use ruma::{
};
use stream_assert::assert_next_matches;
use super::{TestTimeline, BOB};
use super::TestTimeline;
use crate::timeline::{EncryptedMessage, TimelineItemContent};
#[async_test]
@@ -16,7 +16,7 @@ use std::sync::Arc;
use assert_matches::assert_matches;
use eyeball_im::VectorDiff;
use matrix_sdk_test::{async_test, sync_timeline_event};
use matrix_sdk_test::{async_test, sync_timeline_event, ALICE, BOB};
use ruma::{
assign,
events::{
@@ -34,7 +34,7 @@ use ruma::{
};
use stream_assert::assert_next_matches;
use super::{TestTimeline, ALICE, BOB};
use super::TestTimeline;
use crate::timeline::{inner::TimelineInnerSettings, TimelineItemContent};
#[async_test]
@@ -14,7 +14,7 @@
use assert_matches::assert_matches;
use eyeball_im::VectorDiff;
use matrix_sdk_test::{async_test, sync_timeline_event};
use matrix_sdk_test::{async_test, sync_timeline_event, ALICE, BOB};
use ruma::{
assign,
events::{
@@ -26,7 +26,7 @@ use ruma::{
};
use stream_assert::assert_next_matches;
use super::{TestTimeline, ALICE, BOB};
use super::TestTimeline;
use crate::timeline::TimelineItemContent;
#[async_test]
@@ -23,8 +23,7 @@ use futures_core::Stream;
use futures_util::{FutureExt, StreamExt};
use indexmap::IndexMap;
use matrix_sdk::deserialized_responses::{SyncTimelineEvent, TimelineEvent};
use matrix_sdk_test::{sync_timeline_event, EventBuilder};
use once_cell::sync::Lazy;
use matrix_sdk_test::{sync_timeline_event, EventBuilder, ALICE};
use ruma::{
events::{
receipt::{Receipt, ReceiptThread, ReceiptType},
@@ -39,8 +38,8 @@ use ruma::{
push::{PushConditionRoomCtx, Ruleset},
room_id,
serde::Raw,
server_name, uint, user_id, EventId, OwnedEventId, OwnedTransactionId, OwnedUserId,
RoomVersionId, TransactionId, UserId,
server_name, uint, EventId, OwnedEventId, OwnedTransactionId, OwnedUserId, RoomVersionId,
TransactionId, UserId,
};
use super::{
@@ -65,10 +64,6 @@ mod read_receipts;
mod redaction;
mod virt;
static ALICE: Lazy<&UserId> = Lazy::new(|| user_id!("@alice:server.name"));
static BOB: Lazy<&UserId> = Lazy::new(|| user_id!("@bob:other.server"));
static CAROL: Lazy<&UserId> = Lazy::new(|| user_id!("@carol:other.server"));
struct TestTimeline {
inner: TimelineInner<TestRoomDataProvider>,
event_builder: EventBuilder,
@@ -1,4 +1,4 @@
use matrix_sdk_test::async_test;
use matrix_sdk_test::{async_test, ALICE, BOB};
use ruma::{
events::{
poll::{
@@ -15,9 +15,7 @@ use ruma::{
};
use crate::timeline::{
polls::PollState,
tests::{TestTimeline, ALICE, BOB},
EventTimelineItem, TimelineItemContent,
polls::PollState, tests::TestTimeline, EventTimelineItem, TimelineItemContent,
};
#[async_test]
@@ -14,13 +14,10 @@
use assert_matches::assert_matches;
use itertools::Itertools;
use matrix_sdk_test::{ALICE, BOB};
use ruma::{server_name, uint, user_id, EventId, MilliSecondsSinceUnixEpoch, OwnedUserId, UserId};
use crate::timeline::{
event_item::EventItemIdentifier,
tests::{ALICE, BOB},
ReactionGroup, ReactionSenderData,
};
use crate::timeline::{event_item::EventItemIdentifier, ReactionGroup, ReactionSenderData};
#[test]
fn by_sender() {
@@ -19,7 +19,7 @@ use eyeball_im::VectorDiff;
use futures_core::Stream;
use imbl::vector;
use matrix_sdk_base::deserialized_responses::SyncTimelineEvent;
use matrix_sdk_test::async_test;
use matrix_sdk_test::{async_test, ALICE, BOB};
use ruma::{
events::{relation::Annotation, room::message::RoomMessageEventContent},
server_name, uint, EventId, MilliSecondsSinceUnixEpoch, OwnedEventId, TransactionId,
@@ -30,7 +30,7 @@ use crate::timeline::{
event_item::EventItemIdentifier,
inner::ReactionAction,
reactions::ReactionToggleResult,
tests::{assert_event_is_updated, assert_no_more_updates, TestTimeline, ALICE, BOB},
tests::{assert_event_is_updated, assert_no_more_updates, TestTimeline},
TimelineItem,
};
@@ -13,14 +13,14 @@
// limitations under the License.
use eyeball_im::VectorDiff;
use matrix_sdk_test::async_test;
use matrix_sdk_test::{async_test, ALICE, BOB};
use ruma::events::{
receipt::{ReceiptThread, ReceiptType},
room::message::RoomMessageEventContent,
};
use stream_assert::assert_next_matches;
use super::{TestTimeline, ALICE, BOB};
use super::TestTimeline;
use crate::timeline::inner::TimelineInnerSettings;
#[async_test]
@@ -16,7 +16,7 @@ use assert_matches::assert_matches;
use eyeball_im::VectorDiff;
use imbl::vector;
use matrix_sdk_base::deserialized_responses::SyncTimelineEvent;
use matrix_sdk_test::{async_test, sync_timeline_event};
use matrix_sdk_test::{async_test, sync_timeline_event, ALICE, BOB};
use ruma::{
events::{
reaction::{ReactionEventContent, RedactedReactionEventContent},
@@ -34,7 +34,7 @@ use ruma::{
};
use stream_assert::assert_next_matches;
use super::{TestTimeline, ALICE, BOB};
use super::TestTimeline;
use crate::timeline::{AnyOtherFullStateEventContent, TimelineDetails, TimelineItemContent};
#[async_test]
@@ -15,14 +15,14 @@
use assert_matches::assert_matches;
use chrono::{Datelike, Local, TimeZone};
use eyeball_im::VectorDiff;
use matrix_sdk_test::async_test;
use matrix_sdk_test::{async_test, ALICE, BOB};
use ruma::{
event_id,
events::{room::message::RoomMessageEventContent, AnyMessageLikeEventContent},
};
use stream_assert::assert_next_matches;
use super::{TestTimeline, ALICE, BOB};
use super::TestTimeline;
use crate::timeline::{TimelineItemKind, VirtualTimelineItem};
#[async_test]
+9 -1
View File
@@ -1,6 +1,10 @@
use http::Response;
pub use matrix_sdk_test_macros::async_test;
use ruma::api::{client::sync::sync_events::v3::Response as SyncResponse, IncomingResponse};
use once_cell::sync::Lazy;
use ruma::{
api::{client::sync::sync_events::v3::Response as SyncResponse, IncomingResponse},
user_id, UserId,
};
use serde_json::Value as JsonValue;
/// Create a `Raw<AnySyncTimelineEvent>` from arbitrary JSON.
@@ -29,6 +33,10 @@ pub use self::{
},
};
pub static ALICE: Lazy<&UserId> = Lazy::new(|| user_id!("@alice:server.name"));
pub static BOB: Lazy<&UserId> = Lazy::new(|| user_id!("@bob:other.server"));
pub static CAROL: Lazy<&UserId> = Lazy::new(|| user_id!("@carol:other.server"));
/// Embedded sync response files
pub enum SyncResponseFile {
All,