From 493db9dd3ffe58cfda71e8ef790c146a298f3ab4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Wed, 19 Apr 2023 12:25:24 +0200 Subject: [PATCH] sdk-test: Add room member ban sync event MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Kévin Commaille --- .../src/event_builder/test_event.rs | 4 ++++ testing/matrix-sdk-test/src/test_json/mod.rs | 8 ++++---- .../matrix-sdk-test/src/test_json/sync_events.rs | 15 +++++++++++++++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/testing/matrix-sdk-test/src/event_builder/test_event.rs b/testing/matrix-sdk-test/src/event_builder/test_event.rs index 2470b2634..eccc6db43 100644 --- a/testing/matrix-sdk-test/src/event_builder/test_event.rs +++ b/testing/matrix-sdk-test/src/event_builder/test_event.rs @@ -18,6 +18,7 @@ pub enum TimelineTestEvent { HistoryVisibility, JoinRules, Member, + MemberBan, MemberInvite, MemberNameChange, MessageEdit, @@ -47,6 +48,7 @@ impl TimelineTestEvent { Self::HistoryVisibility => test_json::sync_events::HISTORY_VISIBILITY.to_owned(), Self::JoinRules => test_json::sync_events::JOIN_RULES.to_owned(), Self::Member => test_json::sync_events::MEMBER.to_owned(), + Self::MemberBan => test_json::sync_events::MEMBER_BAN.to_owned(), Self::MemberInvite => test_json::sync_events::MEMBER_INVITE.to_owned(), Self::MemberNameChange => test_json::sync_events::MEMBER_NAME_CHANGE.to_owned(), Self::MessageEdit => test_json::sync_events::MESSAGE_EDIT.to_owned(), @@ -81,6 +83,7 @@ pub enum StateTestEvent { HistoryVisibility, JoinRules, Member, + MemberBan, MemberInvite, MemberNameChange, PowerLevels, @@ -103,6 +106,7 @@ impl StateTestEvent { Self::HistoryVisibility => test_json::sync_events::HISTORY_VISIBILITY.to_owned(), Self::JoinRules => test_json::sync_events::JOIN_RULES.to_owned(), Self::Member => test_json::sync_events::MEMBER.to_owned(), + Self::MemberBan => test_json::sync_events::MEMBER_BAN.to_owned(), Self::MemberInvite => test_json::sync_events::MEMBER_INVITE.to_owned(), Self::MemberNameChange => test_json::sync_events::MEMBER_NAME_CHANGE.to_owned(), Self::PowerLevels => test_json::sync_events::POWER_LEVELS.to_owned(), diff --git a/testing/matrix-sdk-test/src/test_json/mod.rs b/testing/matrix-sdk-test/src/test_json/mod.rs index 2db16a39d..5af09dca5 100644 --- a/testing/matrix-sdk-test/src/test_json/mod.rs +++ b/testing/matrix-sdk-test/src/test_json/mod.rs @@ -27,10 +27,10 @@ pub use sync::{ MORE_SYNC, MORE_SYNC_2, SYNC, VOIP_SYNC, }; pub use sync_events::{ - ALIAS, ALIASES, ENCRYPTION, MEMBER, MEMBER_INVITE, MEMBER_NAME_CHANGE, MEMBER_STRIPPED, - MESSAGE_EDIT, MESSAGE_TEXT, NAME, NAME_STRIPPED, POWER_LEVELS, PRESENCE, PUSH_RULES, REACTION, - READ_RECEIPT, READ_RECEIPT_OTHER, REDACTED, REDACTED_INVALID, REDACTED_STATE, REDACTION, TAG, - TOPIC, TOPIC_REDACTION, TYPING, + ALIAS, ALIASES, ENCRYPTION, MEMBER, MEMBER_BAN, MEMBER_INVITE, MEMBER_NAME_CHANGE, + MEMBER_STRIPPED, MESSAGE_EDIT, MESSAGE_TEXT, NAME, NAME_STRIPPED, POWER_LEVELS, PRESENCE, + PUSH_RULES, REACTION, READ_RECEIPT, READ_RECEIPT_OTHER, REDACTED, REDACTED_INVALID, + REDACTED_STATE, REDACTION, TAG, TOPIC, TOPIC_REDACTION, TYPING, }; /// An empty response. diff --git a/testing/matrix-sdk-test/src/test_json/sync_events.rs b/testing/matrix-sdk-test/src/test_json/sync_events.rs index 407d4e2fd..ba63c5282 100644 --- a/testing/matrix-sdk-test/src/test_json/sync_events.rs +++ b/testing/matrix-sdk-test/src/test_json/sync_events.rs @@ -146,6 +146,21 @@ pub static MEMBER: Lazy = Lazy::new(|| { }) }); +pub static MEMBER_BAN: Lazy = Lazy::new(|| { + json!({ + "content": { + "avatar_url": null, + "displayname": "example", + "membership": "ban" + }, + "event_id": "$151800140517rfvjc:localhost", + "origin_server_ts": 151800140, + "sender": "@example:localhost", + "state_key": "@banned:localhost", + "type": "m.room.member", + }) +}); + pub static MEMBER_INVITE: Lazy = Lazy::new(|| { json!({ "content": {