From fd3dc50ebe90d21520c5ff475dc6af8192d3ede3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Tue, 26 May 2020 21:30:15 +0200 Subject: [PATCH] test: Add a copy of the test data to the test crate. --- matrix_sdk_test/src/lib.rs | 22 +- matrix_sdk_test/test_data/context.json | 211 +++++++++++++ matrix_sdk_test/test_data/delete_devices.json | 18 ++ matrix_sdk_test/test_data/devices.json | 10 + matrix_sdk_test/test_data/event_id.json | 3 + matrix_sdk_test/test_data/events/alias.json | 13 + matrix_sdk_test/test_data/events/aliases.json | 15 + matrix_sdk_test/test_data/events/create.json | 15 + .../test_data/events/fully_read.json | 7 + .../test_data/events/history_visibility.json | 13 + .../test_data/events/join_rules.json | 13 + matrix_sdk_test/test_data/events/member.json | 22 ++ .../test_data/events/message_emote.json | 14 + .../test_data/events/message_notice.json | 16 + .../test_data/events/message_text.json | 14 + matrix_sdk_test/test_data/events/name.json | 13 + .../test_data/events/power_levels.json | 31 ++ .../test_data/events/presence.json | 11 + .../test_data/events/redacted.json | 22 ++ .../test_data/events/redacted_invalid.json | 7 + .../test_data/events/redacted_state.json | 21 ++ .../test_data/events/redaction.json | 10 + .../test_data/events/room_avatar.json | 20 ++ matrix_sdk_test/test_data/events/tag.json | 10 + matrix_sdk_test/test_data/events/topic.json | 18 ++ matrix_sdk_test/test_data/events/typing.json | 10 + .../test_data/get_avatar_response.json | 3 + .../test_data/get_displayname_response.json | 3 + .../test_data/get_profile_response.json | 5 + matrix_sdk_test/test_data/invite_sync.json | 56 ++++ .../test_data/joined_members_response.json | 8 + matrix_sdk_test/test_data/keys_claim.json | 17 ++ matrix_sdk_test/test_data/keys_query.json | 27 ++ matrix_sdk_test/test_data/keys_upload.json | 6 + .../test_data/leave_event_sync.json | 64 ++++ matrix_sdk_test/test_data/leave_sync.json | 277 ++++++++++++++++++ .../test_data/limit_exceeded_error.json | 5 + matrix_sdk_test/test_data/login_info.json | 8 + .../test_data/login_invalid_format.json | 6 + matrix_sdk_test/test_data/login_response.json | 6 + .../test_data/login_response_error.json | 4 + .../test_data/logout_response.json | 1 + matrix_sdk_test/test_data/room_id.json | 3 + matrix_sdk_test/test_data/room_messages.json | 45 +++ matrix_sdk_test/test_data/sync.json | 277 ++++++++++++++++++ .../test_data/sync_with_summary.json | 256 ++++++++++++++++ .../test_data/upload_response.json | 3 + 47 files changed, 1648 insertions(+), 11 deletions(-) create mode 100644 matrix_sdk_test/test_data/context.json create mode 100644 matrix_sdk_test/test_data/delete_devices.json create mode 100644 matrix_sdk_test/test_data/devices.json create mode 100644 matrix_sdk_test/test_data/event_id.json create mode 100644 matrix_sdk_test/test_data/events/alias.json create mode 100644 matrix_sdk_test/test_data/events/aliases.json create mode 100644 matrix_sdk_test/test_data/events/create.json create mode 100644 matrix_sdk_test/test_data/events/fully_read.json create mode 100644 matrix_sdk_test/test_data/events/history_visibility.json create mode 100644 matrix_sdk_test/test_data/events/join_rules.json create mode 100644 matrix_sdk_test/test_data/events/member.json create mode 100644 matrix_sdk_test/test_data/events/message_emote.json create mode 100644 matrix_sdk_test/test_data/events/message_notice.json create mode 100644 matrix_sdk_test/test_data/events/message_text.json create mode 100644 matrix_sdk_test/test_data/events/name.json create mode 100644 matrix_sdk_test/test_data/events/power_levels.json create mode 100644 matrix_sdk_test/test_data/events/presence.json create mode 100644 matrix_sdk_test/test_data/events/redacted.json create mode 100644 matrix_sdk_test/test_data/events/redacted_invalid.json create mode 100644 matrix_sdk_test/test_data/events/redacted_state.json create mode 100644 matrix_sdk_test/test_data/events/redaction.json create mode 100644 matrix_sdk_test/test_data/events/room_avatar.json create mode 100644 matrix_sdk_test/test_data/events/tag.json create mode 100644 matrix_sdk_test/test_data/events/topic.json create mode 100644 matrix_sdk_test/test_data/events/typing.json create mode 100644 matrix_sdk_test/test_data/get_avatar_response.json create mode 100644 matrix_sdk_test/test_data/get_displayname_response.json create mode 100644 matrix_sdk_test/test_data/get_profile_response.json create mode 100644 matrix_sdk_test/test_data/invite_sync.json create mode 100644 matrix_sdk_test/test_data/joined_members_response.json create mode 100644 matrix_sdk_test/test_data/keys_claim.json create mode 100644 matrix_sdk_test/test_data/keys_query.json create mode 100644 matrix_sdk_test/test_data/keys_upload.json create mode 100644 matrix_sdk_test/test_data/leave_event_sync.json create mode 100644 matrix_sdk_test/test_data/leave_sync.json create mode 100644 matrix_sdk_test/test_data/limit_exceeded_error.json create mode 100644 matrix_sdk_test/test_data/login_info.json create mode 100644 matrix_sdk_test/test_data/login_invalid_format.json create mode 100644 matrix_sdk_test/test_data/login_response.json create mode 100644 matrix_sdk_test/test_data/login_response_error.json create mode 100644 matrix_sdk_test/test_data/logout_response.json create mode 100644 matrix_sdk_test/test_data/room_id.json create mode 100644 matrix_sdk_test/test_data/room_messages.json create mode 100644 matrix_sdk_test/test_data/sync.json create mode 100644 matrix_sdk_test/test_data/sync_with_summary.json create mode 100644 matrix_sdk_test/test_data/upload_response.json diff --git a/matrix_sdk_test/src/lib.rs b/matrix_sdk_test/src/lib.rs index 2042bb16..41b43ec4 100644 --- a/matrix_sdk_test/src/lib.rs +++ b/matrix_sdk_test/src/lib.rs @@ -71,7 +71,7 @@ impl EventBuilder { variant: fn(Ev) -> Event, ) -> Self { let val: &str = match file { - EventsFile::Typing => include_str!("../../test_data/events/typing.json"), + EventsFile::Typing => include_str!("../test_data/events/typing.json"), _ => panic!("unknown ephemeral event file {:?}", file), }; @@ -109,8 +109,8 @@ impl EventBuilder { variant: fn(Ev) -> RoomEvent, ) -> Self { let val = match file { - EventsFile::Member => include_str!("../../test_data/events/member.json"), - EventsFile::PowerLevels => include_str!("../../test_data/events/power_levels.json"), + EventsFile::Member => include_str!("../test_data/events/member.json"), + EventsFile::PowerLevels => include_str!("../test_data/events/power_levels.json"), _ => panic!("unknown room event file {:?}", file), }; @@ -187,9 +187,9 @@ impl EventBuilder { variant: fn(Ev) -> StateEvent, ) -> Self { let val = match file { - EventsFile::Alias => include_str!("../../test_data/events/alias.json"), - EventsFile::Aliases => include_str!("../../test_data/events/aliases.json"), - EventsFile::Name => include_str!("../../test_data/events/name.json"), + EventsFile::Alias => include_str!("../test_data/events/alias.json"), + EventsFile::Aliases => include_str!("../test_data/events/aliases.json"), + EventsFile::Name => include_str!("../test_data/events/name.json"), _ => panic!("unknown state event file {:?}", file), }; @@ -204,7 +204,7 @@ impl EventBuilder { /// Add an presence event to the presence events `Vec`. pub fn add_presence_event(mut self, file: EventsFile) -> Self { let val = match file { - EventsFile::Presence => include_str!("../../test_data/events/presence.json"), + EventsFile::Presence => include_str!("../test_data/events/presence.json"), _ => panic!("unknown presence event file {:?}", file), }; @@ -338,12 +338,12 @@ pub enum SyncResponseFile { /// Get specific API responses for testing pub fn sync_response(kind: SyncResponseFile) -> SyncResponse { let data = match kind { - SyncResponseFile::Default => include_bytes!("../../test_data/sync.json").to_vec(), + SyncResponseFile::Default => include_bytes!("../test_data/sync.json").to_vec(), SyncResponseFile::DefaultWithSummary => { - include_bytes!("../../test_data/sync_with_summary.json").to_vec() + include_bytes!("../test_data/sync_with_summary.json").to_vec() } - SyncResponseFile::Invite => include_bytes!("../../test_data/invite_sync.json").to_vec(), - SyncResponseFile::Leave => include_bytes!("../../test_data/leave_sync.json").to_vec(), + SyncResponseFile::Invite => include_bytes!("../test_data/invite_sync.json").to_vec(), + SyncResponseFile::Leave => include_bytes!("../test_data/leave_sync.json").to_vec(), }; let response = Response::builder().body(data.to_vec()).unwrap(); diff --git a/matrix_sdk_test/test_data/context.json b/matrix_sdk_test/test_data/context.json new file mode 100644 index 00000000..be92b59b --- /dev/null +++ b/matrix_sdk_test/test_data/context.json @@ -0,0 +1,211 @@ +{ + "events_before": [], + "events_after": [ + { + "content": { + "body": "yeah, let's do that", + "msgtype": "m.text" + }, + "event_id": "$15163623196QOZxj:localhost", + "origin_server_ts": 1516362319505, + "room_id": "!SVkFJHzfwvuaIEawgC:localhost", + "sender": "@example:localhost", + "type": "m.room.message", + "unsigned": { + "age": 43464955731 + }, + "user_id": "@example:localhost", + "age": 43464955731 + } + ], + "start": "t182-189_0_0_0_0_0_0_0_0", + "end": "t184-190_0_0_0_0_0_0_0_0", + "event": { + "content": { + "body": "ok, let's handle invites, joins and parts", + "msgtype": "m.text" + }, + "event_id": "$15163622445EBvZJ:localhost", + "origin_server_ts": 1516362244026, + "room_id": "!SVkFJHzfwvuaIEawgC:localhost", + "sender": "@example2:localhost", + "type": "m.room.message", + "unsigned": { + "age": 43465031210 + }, + "user_id": "@example2:localhost", + "age": 43465031210 + }, + "state": [ + { + "content": { + "topic": "amazing work" + }, + "event_id": "$151568196747dxLZM:localhost", + "origin_server_ts": 1515681967443, + "room_id": "!SVkFJHzfwvuaIEawgC:localhost", + "sender": "@example:localhost", + "state_key": "", + "type": "m.room.topic", + "unsigned": { + "replaces_state": "$151567214844LzHAk:localhost", + "age": 44145307793 + }, + "user_id": "@example:localhost", + "age": 44145307793, + "replaces_state": "$151567214844LzHAk:localhost" + }, + { + "content": { + "aliases": [ + "#tutorial:localhost" + ] + }, + "event_id": "$15139375516NUgtD:localhost", + "origin_server_ts": 1513937551720, + "room_id": "!SVkFJHzfwvuaIEawgC:localhost", + "sender": "@example:localhost", + "state_key": "localhost", + "type": "m.room.aliases", + "unsigned": { + "age": 45889723516 + }, + "user_id": "@example:localhost", + "age": 45889723516 + }, + { + "content": { + "history_visibility": "shared" + }, + "event_id": "$15139375515VaJEY:localhost", + "origin_server_ts": 1513937551613, + "room_id": "!SVkFJHzfwvuaIEawgC:localhost", + "sender": "@example:localhost", + "state_key": "", + "type": "m.room.history_visibility", + "unsigned": { + "age": 45889723623 + }, + "user_id": "@example:localhost", + "age": 45889723623 + }, + { + "content": { + "join_rule": "public" + }, + "event_id": "$15139375514WsgmR:localhost", + "origin_server_ts": 1513937551539, + "room_id": "!SVkFJHzfwvuaIEawgC:localhost", + "sender": "@example:localhost", + "state_key": "", + "type": "m.room.join_rules", + "unsigned": { + "age": 45889723697 + }, + "user_id": "@example:localhost", + "age": 45889723697 + }, + { + "content": { + "alias": "#tutorial:localhost" + }, + "event_id": "$15139375513VdeRF:localhost", + "origin_server_ts": 1513937551461, + "room_id": "!SVkFJHzfwvuaIEawgC:localhost", + "sender": "@example:localhost", + "state_key": "", + "type": "m.room.canonical_alias", + "unsigned": { + "age": 45889723775 + }, + "user_id": "@example:localhost", + "age": 45889723775 + }, + { + "content": { + "ban": 50, + "events": { + "m.room.avatar": 50, + "m.room.canonical_alias": 50, + "m.room.history_visibility": 100, + "m.room.name": 50, + "m.room.power_levels": 100 + }, + "events_default": 0, + "invite": 0, + "kick": 50, + "redact": 50, + "state_default": 50, + "users": { + "@example:localhost": 100 + }, + "users_default": 0 + }, + "event_id": "$15139375512JaHAW:localhost", + "origin_server_ts": 1513937551359, + "room_id": "!SVkFJHzfwvuaIEawgC:localhost", + "sender": "@example:localhost", + "state_key": "", + "type": "m.room.power_levels", + "unsigned": { + "age": 45889723877 + }, + "user_id": "@example:localhost", + "age": 45889723877 + }, + { + "content": { + "creator": "@example:localhost" + }, + "event_id": "$15139375510KUZHi:localhost", + "origin_server_ts": 1513937551203, + "room_id": "!SVkFJHzfwvuaIEawgC:localhost", + "sender": "@example:localhost", + "state_key": "", + "type": "m.room.create", + "unsigned": { + "age": 45889724033 + }, + "user_id": "@example:localhost", + "age": 45889724033 + }, + { + "content": { + "avatar_url": null, + "displayname": "example2", + "membership": "join" + }, + "event_id": "$151396611913abyeC:localhost", + "membership": "join", + "origin_server_ts": 1513966119908, + "room_id": "!SVkFJHzfwvuaIEawgC:localhost", + "sender": "@example2:localhost", + "state_key": "@example2:localhost", + "type": "m.room.member", + "unsigned": { + "age": 45861155328 + }, + "user_id": "@example2:localhost", + "age": 45861155328 + }, + { + "content": { + "avatar_url": null, + "displayname": "example", + "membership": "join" + }, + "event_id": "$15139375511GBYDY:localhost", + "membership": "join", + "origin_server_ts": 1513937551274, + "room_id": "!SVkFJHzfwvuaIEawgC:localhost", + "sender": "@example:localhost", + "state_key": "@example:localhost", + "type": "m.room.member", + "unsigned": { + "age": 45889723962 + }, + "user_id": "@example:localhost", + "age": 45889723962 + } + ] +} diff --git a/matrix_sdk_test/test_data/delete_devices.json b/matrix_sdk_test/test_data/delete_devices.json new file mode 100644 index 00000000..aa4c1330 --- /dev/null +++ b/matrix_sdk_test/test_data/delete_devices.json @@ -0,0 +1,18 @@ +{ + "completed": [ + "example.type.foo" + ], + "flows": [ + { + "stages": [ + "example.type.foo" + ] + } + ], + "params": { + "example.type.baz": { + "example_key": "foobar" + } + }, + "session": "xxxxxxyz" +} diff --git a/matrix_sdk_test/test_data/devices.json b/matrix_sdk_test/test_data/devices.json new file mode 100644 index 00000000..a3af5a3d --- /dev/null +++ b/matrix_sdk_test/test_data/devices.json @@ -0,0 +1,10 @@ +{ + "devices": [ + { + "device_id": "QBUAZIFURK", + "display_name": "android", + "last_seen_ip": "1.2.3.4", + "last_seen_ts": 1474491775024 + } + ] +} diff --git a/matrix_sdk_test/test_data/event_id.json b/matrix_sdk_test/test_data/event_id.json new file mode 100644 index 00000000..bf423646 --- /dev/null +++ b/matrix_sdk_test/test_data/event_id.json @@ -0,0 +1,3 @@ +{ + "event_id": "$h29iv0s8:example.com" +} diff --git a/matrix_sdk_test/test_data/events/alias.json b/matrix_sdk_test/test_data/events/alias.json new file mode 100644 index 00000000..48196492 --- /dev/null +++ b/matrix_sdk_test/test_data/events/alias.json @@ -0,0 +1,13 @@ +{ + "content": { + "alias": "#tutorial:localhost" + }, + "event_id": "$15139375513VdeRF:localhost", + "origin_server_ts": 1513937551461, + "sender": "@example:localhost", + "state_key": "", + "type": "m.room.canonical_alias", + "unsigned": { + "age": 7034220433 + } +} diff --git a/matrix_sdk_test/test_data/events/aliases.json b/matrix_sdk_test/test_data/events/aliases.json new file mode 100644 index 00000000..5b81aa2d --- /dev/null +++ b/matrix_sdk_test/test_data/events/aliases.json @@ -0,0 +1,15 @@ +{ + "content": { + "aliases": [ + "#tutorial:localhost" + ] + }, + "event_id": "$15139375516NUgtD:localhost", + "origin_server_ts": 1513937551720, + "sender": "@example:localhost", + "state_key": "localhost", + "type": "m.room.aliases", + "unsigned": { + "age": 7034220174 + } +} diff --git a/matrix_sdk_test/test_data/events/create.json b/matrix_sdk_test/test_data/events/create.json new file mode 100644 index 00000000..8b3a5926 --- /dev/null +++ b/matrix_sdk_test/test_data/events/create.json @@ -0,0 +1,15 @@ +{ + "content": { + "creator": "@example:localhost", + "m.federate": true, + "room_version": "1" + }, + "event_id": "$151957878228ekrDs:localhost", + "origin_server_ts": 1519578782185, + "sender": "@example:localhost", + "state_key": "", + "type": "m.room.create", + "unsigned": { + "age": 1392989709 + } +} diff --git a/matrix_sdk_test/test_data/events/fully_read.json b/matrix_sdk_test/test_data/events/fully_read.json new file mode 100644 index 00000000..c736e515 --- /dev/null +++ b/matrix_sdk_test/test_data/events/fully_read.json @@ -0,0 +1,7 @@ +{ + "content": { + "event_id": "$someplace:example.org" + }, + "room_id": "!somewhere:example.org", + "type": "m.fully_read" +} diff --git a/matrix_sdk_test/test_data/events/history_visibility.json b/matrix_sdk_test/test_data/events/history_visibility.json new file mode 100644 index 00000000..fae3be3b --- /dev/null +++ b/matrix_sdk_test/test_data/events/history_visibility.json @@ -0,0 +1,13 @@ +{ + "content": { + "history_visibility": "world_readable" + }, + "event_id": "$151957878235ricnD:localhost", + "origin_server_ts": 1519578782195, + "sender": "@example:localhost", + "state_key": "", + "type": "m.room.history_visibility", + "unsigned": { + "age": 1392989715 + } +} diff --git a/matrix_sdk_test/test_data/events/join_rules.json b/matrix_sdk_test/test_data/events/join_rules.json new file mode 100644 index 00000000..7c116ae6 --- /dev/null +++ b/matrix_sdk_test/test_data/events/join_rules.json @@ -0,0 +1,13 @@ +{ + "content": { + "join_rule": "public" + }, + "event_id": "$151957878231iejdB:localhost", + "origin_server_ts": 1519578782192, + "sender": "@example:localhost", + "state_key": "", + "type": "m.room.join_rules", + "unsigned": { + "age": 1392989713 + } +} diff --git a/matrix_sdk_test/test_data/events/member.json b/matrix_sdk_test/test_data/events/member.json new file mode 100644 index 00000000..10424dcb --- /dev/null +++ b/matrix_sdk_test/test_data/events/member.json @@ -0,0 +1,22 @@ +{ + "content": { + "avatar_url": null, + "displayname": "example", + "membership": "join" + }, + "event_id": "$151800140517rfvjc:localhost", + "membership": "join", + "origin_server_ts": 1518001405556, + "sender": "@example:localhost", + "state_key": "@example:localhost", + "type": "m.room.member", + "unsigned": { + "age": 2970366338, + "replaces_state": "$151800111315tsynI:localhost", + "prev_content": { + "avatar_url": null, + "displayname": "example", + "membership": "invite" + } + } +} diff --git a/matrix_sdk_test/test_data/events/message_emote.json b/matrix_sdk_test/test_data/events/message_emote.json new file mode 100644 index 00000000..146ce548 --- /dev/null +++ b/matrix_sdk_test/test_data/events/message_emote.json @@ -0,0 +1,14 @@ +{ + "content": { + "body": "is dancing", "format": "org.matrix.custom.html", + "formatted_body": "is dancing", + "msgtype": "m.emote" + }, + "event_id": "$152037280074GZeOm:localhost", + "origin_server_ts": 1520372800469, + "sender": "@example:localhost", + "type": "m.room.message", + "unsigned": { + "age": 598971425 + } +} diff --git a/matrix_sdk_test/test_data/events/message_notice.json b/matrix_sdk_test/test_data/events/message_notice.json new file mode 100644 index 00000000..6215c904 --- /dev/null +++ b/matrix_sdk_test/test_data/events/message_notice.json @@ -0,0 +1,16 @@ +{ + "origin_server_ts": 1533565163841, + "sender": "@_neb_github:matrix.org", + "event_id": "$153356516319138IHRIC:matrix.org", + "unsigned": { + "age": 743 + }, + "content": { + "body": "https://github.com/matrix-org/matrix-python-sdk/issues/266 : Consider allowing MatrixClient.__init__ to take sync_token kwarg", + "format": "org.matrix.custom.html", + "formatted_body": "313: nio wins!", + "msgtype": "m.notice" + }, + "type": "m.room.message", + "room_id": "!YHhmBTmGBHGQOlGpaZ:matrix.org" +} diff --git a/matrix_sdk_test/test_data/events/message_text.json b/matrix_sdk_test/test_data/events/message_text.json new file mode 100644 index 00000000..b95607cd --- /dev/null +++ b/matrix_sdk_test/test_data/events/message_text.json @@ -0,0 +1,14 @@ +{ + "content": { + "body": "is dancing", "format": "org.matrix.custom.html", + "formatted_body": "is dancing", + "msgtype": "m.text" + }, + "event_id": "$152037280074GZeOm:localhost", + "origin_server_ts": 1520372800469, + "sender": "@example:localhost", + "type": "m.room.message", + "unsigned": { + "age": 598971425 + } +} diff --git a/matrix_sdk_test/test_data/events/name.json b/matrix_sdk_test/test_data/events/name.json new file mode 100644 index 00000000..fa70a945 --- /dev/null +++ b/matrix_sdk_test/test_data/events/name.json @@ -0,0 +1,13 @@ +{ + "content": { + "name": "room name" + }, + "event_id": "$15139375513VdeRF:localhost", + "origin_server_ts": 1513937551461, + "sender": "@example:localhost", + "state_key": "", + "type": "m.room.name", + "unsigned": { + "age": 7034220433 + } +} diff --git a/matrix_sdk_test/test_data/events/power_levels.json b/matrix_sdk_test/test_data/events/power_levels.json new file mode 100644 index 00000000..427b0b57 --- /dev/null +++ b/matrix_sdk_test/test_data/events/power_levels.json @@ -0,0 +1,31 @@ +{ + "content": { + "ban": 50, + "events": { + "m.room.avatar": 50, + "m.room.canonical_alias": 50, + "m.room.history_visibility": 100, + "m.room.name": 50, + "m.room.power_levels": 100, + "m.room.message": 25 + }, + "events_default": 0, + "invite": 0, + "kick": 50, + "redact": 50, + "state_default": 50, + "users": { + "@example:localhost": 100, + "@bob:localhost": 0 + }, + "users_default": 0 + }, + "event_id": "$15139375512JaHAW:localhost", + "origin_server_ts": 1513937551359, + "sender": "@example:localhost", + "state_key": "", + "type": "m.room.power_levels", + "unsigned": { + "age": 7034220535 + } +} diff --git a/matrix_sdk_test/test_data/events/presence.json b/matrix_sdk_test/test_data/events/presence.json new file mode 100644 index 00000000..0c740980 --- /dev/null +++ b/matrix_sdk_test/test_data/events/presence.json @@ -0,0 +1,11 @@ +{ + "content": { + "avatar_url": "mxc://localhost:wefuiwegh8742w", + "currently_active": false, + "last_active_ago": 1, + "presence": "online", + "status_msg": "Making cupcakes" + }, + "sender": "@example:localhost", + "type": "m.presence" +} diff --git a/matrix_sdk_test/test_data/events/redacted.json b/matrix_sdk_test/test_data/events/redacted.json new file mode 100644 index 00000000..ae1a3ce3 --- /dev/null +++ b/matrix_sdk_test/test_data/events/redacted.json @@ -0,0 +1,22 @@ +{ + "content": {}, + "event_id": "$15275046980maRLj:localhost", + "origin_server_ts": 1527504698685, + "sender": "@example:localhost", + "type": "m.room.message", + "unsigned": { + "age": 19334, + "redacted_because": { + "content": {}, + "event_id": "$15275047031IXQRi:localhost", + "origin_server_ts": 1527504703496, + "redacts": "$15275046980maRLj:localhost", + "sender": "@example:localhost", + "type": "m.room.redaction", + "unsigned": { + "age": 14523 + } + }, + "redacted_by": "$15275047031IXQRi:localhost" + } +} diff --git a/matrix_sdk_test/test_data/events/redacted_invalid.json b/matrix_sdk_test/test_data/events/redacted_invalid.json new file mode 100644 index 00000000..47fb283b --- /dev/null +++ b/matrix_sdk_test/test_data/events/redacted_invalid.json @@ -0,0 +1,7 @@ +{ + "content": {}, + "event_id": "$15275046980maRLj:localhost", + "origin_server_ts": 1527504698685, + "sender": "@example:localhost", + "type": "m.room.message" +} diff --git a/matrix_sdk_test/test_data/events/redacted_state.json b/matrix_sdk_test/test_data/events/redacted_state.json new file mode 100644 index 00000000..3968ec14 --- /dev/null +++ b/matrix_sdk_test/test_data/events/redacted_state.json @@ -0,0 +1,21 @@ +{ + "content": {}, + "event_id": "$example_id:example.org", + "origin_server_ts": 1532324933640, + "sender": "@example:example.org", + "state_key": "test_state_key", + "type": "m.some.state", + "unsigned": { + "age": 30693154231, + "redacted_because": { + "content": {}, + "event_id": "$redaction_example_id:example.org", + "origin_server_ts": 1532324940702, + "redacts": "$example_id:example.org", + "sender": "@example:example:org", + "type": "m.room.redaction", + "unsigned": {"age": 30693147169} + }, + "redacted_by": "$redaction_example_id:example.org" + } +} diff --git a/matrix_sdk_test/test_data/events/redaction.json b/matrix_sdk_test/test_data/events/redaction.json new file mode 100644 index 00000000..5047d2f3 --- /dev/null +++ b/matrix_sdk_test/test_data/events/redaction.json @@ -0,0 +1,10 @@ +{ + "content": { + "reason": "😀" + }, + "event_id": "$151957878228ssqrJ:localhost", + "origin_server_ts": 1519578782185, + "sender": "@example:localhost", + "type": "m.room.redaction", + "redacts": "$151957878228ssqrj:localhost" +} diff --git a/matrix_sdk_test/test_data/events/room_avatar.json b/matrix_sdk_test/test_data/events/room_avatar.json new file mode 100644 index 00000000..92ed2519 --- /dev/null +++ b/matrix_sdk_test/test_data/events/room_avatar.json @@ -0,0 +1,20 @@ +{ + "content": { + "info": { + "h": 398, + "mimetype": "image/jpeg", + "size": 31037, + "w": 394 + }, + "url": "mxc://domain.com/JWEIFJgwEIhweiWJE" + }, + "event_id": "$143273582443PhrSn:domain.com", + "origin_server_ts": 1432735824653, + "room_id": "!jEsUZKDJdhlrceRyVU:domain.com", + "sender": "@example:domain.com", + "state_key": "", + "type": "m.room.avatar", + "unsigned": { + "age": 1234 + } +} diff --git a/matrix_sdk_test/test_data/events/tag.json b/matrix_sdk_test/test_data/events/tag.json new file mode 100644 index 00000000..b42b06db --- /dev/null +++ b/matrix_sdk_test/test_data/events/tag.json @@ -0,0 +1,10 @@ +{ + "content": { + "tags": { + "u.work": { + "order": 0.9 + } + } + }, + "type": "m.tag" +} diff --git a/matrix_sdk_test/test_data/events/topic.json b/matrix_sdk_test/test_data/events/topic.json new file mode 100644 index 00000000..930ff0a3 --- /dev/null +++ b/matrix_sdk_test/test_data/events/topic.json @@ -0,0 +1,18 @@ +{ + "content": { + "topic": "😀" + }, + "event_id": "$151957878228ssqrJ:localhost", + "origin_server_ts": 1519578782185, + "sender": "@example:localhost", + "state_key": "", + "type": "m.room.topic", + "unsigned": { + "age": 1392989709, + "prev_content": { + "topic": "test" + }, + "prev_sender": "@example:localhost", + "replaces_state": "$151957069225EVYKm:localhost" + } +} diff --git a/matrix_sdk_test/test_data/events/typing.json b/matrix_sdk_test/test_data/events/typing.json new file mode 100644 index 00000000..52949f76 --- /dev/null +++ b/matrix_sdk_test/test_data/events/typing.json @@ -0,0 +1,10 @@ +{ + "content": { + "user_ids": [ + "@alice:matrix.org", + "@bob:example.com" + ] + }, + "room_id": "!jEsUZKDJdhlrceRyVU:example.org", + "type": "m.typing" +} diff --git a/matrix_sdk_test/test_data/get_avatar_response.json b/matrix_sdk_test/test_data/get_avatar_response.json new file mode 100644 index 00000000..9227a544 --- /dev/null +++ b/matrix_sdk_test/test_data/get_avatar_response.json @@ -0,0 +1,3 @@ +{ + "avatar_url": "mxc://matrix.org/SDGdghriugerRg" +} diff --git a/matrix_sdk_test/test_data/get_displayname_response.json b/matrix_sdk_test/test_data/get_displayname_response.json new file mode 100644 index 00000000..fed57979 --- /dev/null +++ b/matrix_sdk_test/test_data/get_displayname_response.json @@ -0,0 +1,3 @@ +{ + "displayname": "Bob" +} diff --git a/matrix_sdk_test/test_data/get_profile_response.json b/matrix_sdk_test/test_data/get_profile_response.json new file mode 100644 index 00000000..4abbd6fb --- /dev/null +++ b/matrix_sdk_test/test_data/get_profile_response.json @@ -0,0 +1,5 @@ +{ + "displayname": "Bob", + "avatar_url": "mxc://matrix.org/SDGdghriugerRg", + "something_else": 123 +} diff --git a/matrix_sdk_test/test_data/invite_sync.json b/matrix_sdk_test/test_data/invite_sync.json new file mode 100644 index 00000000..42852a2e --- /dev/null +++ b/matrix_sdk_test/test_data/invite_sync.json @@ -0,0 +1,56 @@ +{ + "device_one_time_keys_count": {}, + "next_batch": "s526_47314_0_7_1_1_1_11444_1", + "device_lists": { + "changed": [ + "@example:example.org" + ], + "left": [] + }, + "rooms": { + "invite": { + "!696r7674:example.com": { + "invite_state": { + "events": [ + { + "sender": "@alice:example.com", + "type": "m.room.name", + "state_key": "", + "content": { + "name": "My Room Name" + } + }, + { + "sender": "@alice:example.com", + "type": "m.room.member", + "state_key": "@bob:example.com", + "content": { + "membership": "invite" + } + } + ] + } + } + }, + "join": {}, + "leave": {} + }, + "to_device": { + "events": [] + }, + "presence": { + "events": [ + { + "content": { + "avatar_url": "mxc://localhost:wefuiwegh8742w", + "currently_active": false, + "last_active_ago": 1, + "presence": "online", + "status_msg": "Making cupcakes" + }, + "sender": "@example:localhost", + "type": "m.presence" + } + ] + } +} diff --git a/matrix_sdk_test/test_data/joined_members_response.json b/matrix_sdk_test/test_data/joined_members_response.json new file mode 100644 index 00000000..c2458a29 --- /dev/null +++ b/matrix_sdk_test/test_data/joined_members_response.json @@ -0,0 +1,8 @@ +{ + "joined": { + "@bar:example.com": { + "avatar_url": null, + "display_name": "Bar" + } + } +} diff --git a/matrix_sdk_test/test_data/keys_claim.json b/matrix_sdk_test/test_data/keys_claim.json new file mode 100644 index 00000000..1712d52e --- /dev/null +++ b/matrix_sdk_test/test_data/keys_claim.json @@ -0,0 +1,17 @@ +{ + "failures": {}, + "one_time_keys": { + "@alice:example.com": { + "JLAFKJWSCS": { + "signed_curve25519:AAAAHg": { + "key": "zKbLg+NrIjpnagy+pIY6uPL4ZwEG2v+8F9lmgsnlZzs", + "signatures": { + "@alice:example.com": { + "ed25519:JLAFKJWSCS": "FLWxXqGbwrb8SM3Y795eB6OA8bwBcoMZFXBqnTn58AYWZSqiD45tlBVcDa2L7RwdKXebW/VzDlnfVJ+9jok1Bw" + } + } + } + } + } + } +} diff --git a/matrix_sdk_test/test_data/keys_query.json b/matrix_sdk_test/test_data/keys_query.json new file mode 100644 index 00000000..66b112df --- /dev/null +++ b/matrix_sdk_test/test_data/keys_query.json @@ -0,0 +1,27 @@ +{ + "device_keys": { + "@alice:example.org": { + "JLAFKJWSCS": { + "algorithms": [ + "m.olm.v1.curve25519-aes-sha2", + "m.megolm.v1.aes-sha2" + ], + "device_id": "JLAFKJWSCS", + "user_id": "@alice:example.org", + "keys": { + "curve25519:JLAFKJWSCS": "wjLpTLRqbqBzLs63aYaEv2Boi6cFEbbM/sSRQ2oAKk4", + "ed25519:JLAFKJWSCS": "nE6W2fCblxDcOFmeEtCHNl8/l8bXcu7GKyAswA4r3mM" + }, + "signatures": { + "@alice:example.org": { + "ed25519:JLAFKJWSCS": "m53Wkbh2HXkc3vFApZvCrfXcX3AI51GsDHustMhKwlv3TuOJMj4wistcOTM8q2+e/Ro7rWFUb9ZfnNbwptSUBA" + } + }, + "unsigned": { + "device_display_name": "Alice's mobile phone" + } + } + } + }, + "failures": {} +} diff --git a/matrix_sdk_test/test_data/keys_upload.json b/matrix_sdk_test/test_data/keys_upload.json new file mode 100644 index 00000000..e32a62c4 --- /dev/null +++ b/matrix_sdk_test/test_data/keys_upload.json @@ -0,0 +1,6 @@ +{ + "one_time_key_counts": { + "curve25519": 10, + "signed_curve25519": 20 + } +} diff --git a/matrix_sdk_test/test_data/leave_event_sync.json b/matrix_sdk_test/test_data/leave_event_sync.json new file mode 100644 index 00000000..bd6c7d23 --- /dev/null +++ b/matrix_sdk_test/test_data/leave_event_sync.json @@ -0,0 +1,64 @@ +{ + "account_data": { + "events": [] + }, + "to_device": { + "events": [] + }, + "device_lists": { + "changed": [], + "left": [] + }, + "presence": { + "events": [] + }, + "rooms": { + "join": {}, + "invite": {}, + "leave": { + "!SVkFJHzfwvuaIEawgC:localhost": { + "timeline": { + "events": [ + { + "content": { + "membership": "leave" + }, + "origin_server_ts": 1589578095276, + "sender": "@example:localhost", + "state_key": "@example:localhost", + "type": "m.room.member", + "unsigned": { + "replaces_state": "$blahblah", + "prev_content": { + "avatar_url": null, + "displayname": "me", + "membership": "invite" + }, + "prev_sender": "@2example:localhost", + "age": 1757 + }, + "event_id": "$lQQ116Y-XqcjpSUGpuz36rNntUvOSpTjuaIvmtQ2AwA" + } + ], + "prev_batch": "tokenTOKEN", + "limited": false + }, + "state": { + "events": [] + }, + "account_data": { + "events": [] + } + } + } + }, + "groups": { + "join": {}, + "invite": {}, + "leave": {} + }, + "device_one_time_keys_count": { + "signed_curve25519": 50 + }, + "next_batch": "s1380317562_757269739_1655566_503953763_334052043_1209862_55290918_65705002_101146" +} diff --git a/matrix_sdk_test/test_data/leave_sync.json b/matrix_sdk_test/test_data/leave_sync.json new file mode 100644 index 00000000..bcac1680 --- /dev/null +++ b/matrix_sdk_test/test_data/leave_sync.json @@ -0,0 +1,277 @@ +{ + "device_one_time_keys_count": {}, + "next_batch": "s526_47314_0_7_1_1_1_11444_1", + "device_lists": { + "changed": [ + "@example:example.org" + ], + "left": [] + }, + "rooms": { + "invite": {}, + "join": {}, + "leave": { + "!SVkFJHzfwvuaIEawgC:localhost": { + "summary": {}, + "account_data": { + "events": [ + { + "content": { + "event_id": "$someplace:example.org" + }, + "room_id": "!roomid:room.com", + "type": "m.fully_read" + }, + { + "content": { + "ignored_users": { + "@someone:example.org": {} + } + }, + "type": "m.ignored_user_list" + } + ] + }, + "ephemeral": { + "events": [ + { + "content": { + "$151680659217152dPKjd:localhost": { + "m.read": { + "@example:localhost": { + "ts": 1516809890615 + } + } + } + }, + "type": "m.receipt" + } + ] + }, + "state": { + "events": [ + { + "content": { + "join_rule": "public" + }, + "event_id": "$15139375514WsgmR:localhost", + "origin_server_ts": 1513937551539, + "sender": "@example:localhost", + "state_key": "", + "type": "m.room.join_rules", + "unsigned": { + "age": 7034220355 + } + }, + { + "content": { + "avatar_url": null, + "displayname": "example", + "membership": "join" + }, + "event_id": "$151800140517rfvjc:localhost", + "membership": "join", + "origin_server_ts": 1518001405556, + "sender": "@example:localhost", + "state_key": "@example:localhost", + "type": "m.room.member", + "unsigned": { + "age": 2970366338, + "replaces_state": "$151800111315tsynI:localhost" + } + }, + { + "content": { + "history_visibility": "shared" + }, + "event_id": "$15139375515VaJEY:localhost", + "origin_server_ts": 1513937551613, + "sender": "@example:localhost", + "state_key": "", + "type": "m.room.history_visibility", + "unsigned": { + "age": 7034220281 + } + }, + { + "content": { + "creator": "@example:localhost" + }, + "event_id": "$15139375510KUZHi:localhost", + "origin_server_ts": 1513937551203, + "sender": "@example:localhost", + "state_key": "", + "type": "m.room.create", + "unsigned": { + "age": 7034220691 + } + }, + { + "content": { + "aliases": [ + "#tutorial:localhost" + ] + }, + "event_id": "$15139375516NUgtD:localhost", + "origin_server_ts": 1513937551720, + "sender": "@example:localhost", + "state_key": "localhost", + "type": "m.room.aliases", + "unsigned": { + "age": 7034220174 + } + }, + { + "content": { + "topic": "\ud83d\ude00" + }, + "event_id": "$151957878228ssqrJ:localhost", + "origin_server_ts": 1519578782185, + "sender": "@example:localhost", + "state_key": "", + "type": "m.room.topic", + "unsigned": { + "age": 1392989709, + "prev_content": { + "topic": "test" + }, + "prev_sender": "@example:localhost", + "replaces_state": "$151957069225EVYKm:localhost" + } + }, + { + "content": { + "ban": 50, + "events": { + "m.room.avatar": 50, + "m.room.canonical_alias": 50, + "m.room.history_visibility": 100, + "m.room.name": 50, + "m.room.power_levels": 100 + }, + "events_default": 0, + "invite": 0, + "kick": 50, + "redact": 50, + "state_default": 50, + "users": { + "@example:localhost": 100 + }, + "users_default": 0 + }, + "event_id": "$15139375512JaHAW:localhost", + "origin_server_ts": 1513937551359, + "sender": "@example:localhost", + "state_key": "", + "type": "m.room.power_levels", + "unsigned": { + "age": 7034220535 + } + }, + { + "content": { + "alias": "#tutorial:localhost" + }, + "event_id": "$15139375513VdeRF:localhost", + "origin_server_ts": 1513937551461, + "sender": "@example:localhost", + "state_key": "", + "type": "m.room.canonical_alias", + "unsigned": { + "age": 7034220433 + } + }, + { + "content": { + "avatar_url": null, + "displayname": "example2", + "membership": "join" + }, + "event_id": "$152034824468gOeNB:localhost", + "membership": "join", + "origin_server_ts": 1520348244605, + "sender": "@example2:localhost", + "state_key": "@example2:localhost", + "type": "m.room.member", + "unsigned": { + "age": 623527289, + "prev_content": { + "membership": "leave" + }, + "prev_sender": "@example:localhost", + "replaces_state": "$152034819067QWJxM:localhost" + } + }, + { + "content": { + "membership": "leave", + "reason": "offline", + "avatar_url": "avatar.com", + "displayname": "example" + }, + "event_id": "$1585345508297748AIUBh:matrix.org", + "origin_server_ts": 1585345508223, + "sender": "@example:localhost", + "state_key": "@example:localhost", + "type": "m.room.member", + "unsigned": { + "replaces_state": "$1585345354296486IGZfp:localhost", + "prev_content": { + "avatar_url": "avatar.com", + "displayname": "example", + "membership": "join" + }, + "prev_sender": "@example2:localhost", + "age": 6992 + }, + "room_id": "!roomid:room.com" + } + ] + }, + "timeline": { + "events": [ + { + "content": { + "body": "baba", + "format": "org.matrix.custom.html", + "formatted_body": "baba", + "msgtype": "m.text" + }, + "event_id": "$152037280074GZeOm:localhost", + "origin_server_ts": 1520372800469, + "sender": "@example:localhost", + "type": "m.room.message", + "unsigned": { + "age": 598971425 + } + } + ], + "limited": true, + "prev_batch": "t392-516_47314_0_7_1_1_1_11444_1" + }, + "unread_notifications": { + "highlight_count": 0, + "notification_count": 11 + } + } + } + }, + "to_device": { + "events": [] + }, + "presence": { + "events": [ + { + "content": { + "avatar_url": "mxc://localhost:wefuiwegh8742w", + "currently_active": false, + "last_active_ago": 1, + "presence": "online", + "status_msg": "Making cupcakes" + }, + "sender": "@example:localhost", + "type": "m.presence" + } + ] + } +} diff --git a/matrix_sdk_test/test_data/limit_exceeded_error.json b/matrix_sdk_test/test_data/limit_exceeded_error.json new file mode 100644 index 00000000..84b23a56 --- /dev/null +++ b/matrix_sdk_test/test_data/limit_exceeded_error.json @@ -0,0 +1,5 @@ +{ + "errcode": "M_LIMIT_EXCEEDED", + "error": "Too many requests", + "retry_after_ms": 500 +} diff --git a/matrix_sdk_test/test_data/login_info.json b/matrix_sdk_test/test_data/login_info.json new file mode 100644 index 00000000..968f4955 --- /dev/null +++ b/matrix_sdk_test/test_data/login_info.json @@ -0,0 +1,8 @@ +{ + "flows": [ + { + "type": "m.login.sso", + "type": "m.login.password" + } + ] +} diff --git a/matrix_sdk_test/test_data/login_invalid_format.json b/matrix_sdk_test/test_data/login_invalid_format.json new file mode 100644 index 00000000..af084720 --- /dev/null +++ b/matrix_sdk_test/test_data/login_invalid_format.json @@ -0,0 +1,6 @@ +{ + "access_token": "abc123", + "device_id": "GHTYAJCE", + "home_server": "matrix.org", + "user_id": "cheeky_monkey" +} diff --git a/matrix_sdk_test/test_data/login_response.json b/matrix_sdk_test/test_data/login_response.json new file mode 100644 index 00000000..6bff348a --- /dev/null +++ b/matrix_sdk_test/test_data/login_response.json @@ -0,0 +1,6 @@ +{ + "access_token": "abc123", + "device_id": "GHTYAJCE", + "home_server": "matrix.org", + "user_id": "@cheeky_monkey:matrix.org" +} diff --git a/matrix_sdk_test/test_data/login_response_error.json b/matrix_sdk_test/test_data/login_response_error.json new file mode 100644 index 00000000..9e573c1a --- /dev/null +++ b/matrix_sdk_test/test_data/login_response_error.json @@ -0,0 +1,4 @@ +{ + "errcode": "M_FORBIDDEN", + "error": "Invalid password" +} diff --git a/matrix_sdk_test/test_data/logout_response.json b/matrix_sdk_test/test_data/logout_response.json new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/matrix_sdk_test/test_data/logout_response.json @@ -0,0 +1 @@ +{} diff --git a/matrix_sdk_test/test_data/room_id.json b/matrix_sdk_test/test_data/room_id.json new file mode 100644 index 00000000..75974b00 --- /dev/null +++ b/matrix_sdk_test/test_data/room_id.json @@ -0,0 +1,3 @@ +{ + "room_id": "!testroom:example.org" +} diff --git a/matrix_sdk_test/test_data/room_messages.json b/matrix_sdk_test/test_data/room_messages.json new file mode 100644 index 00000000..b394266e --- /dev/null +++ b/matrix_sdk_test/test_data/room_messages.json @@ -0,0 +1,45 @@ +{ + "chunk": [ + { + "age": 1042, + "content": { + "body": "hello world", + "msgtype": "m.text" + }, + "event_id": "$1444812213350496Caaaa:example.com", + "origin_server_ts": 1444812213737, + "room_id": "!Xq3620DUiqCaoxq:example.com", + "sender": "@alice:example.com", + "type": "m.room.message" + }, + { + "age": 20123, + "content": { + "body": "the world is big", + "msgtype": "m.text" + }, + "event_id": "$1444812213350496Cbbbb:example.com", + "origin_server_ts": 1444812194656, + "room_id": "!Xq3620DUiqCaoxq:example.com", + "sender": "@bob:example.com", + "type": "m.room.message" + }, + { + "age": 50789, + "content": { + "name": "New room name" + }, + "event_id": "$1444812213350496Ccccc:example.com", + "origin_server_ts": 1444812163990, + "prev_content": { + "name": "Old room name" + }, + "room_id": "!Xq3620DUiqCaoxq:example.com", + "sender": "@bob:example.com", + "state_key": "", + "type": "m.room.name" + } + ], + "end": "t47409-4357353_219380_26003_2265", + "start": "t47429-4392820_219380_26003_2265" +} diff --git a/matrix_sdk_test/test_data/sync.json b/matrix_sdk_test/test_data/sync.json new file mode 100644 index 00000000..a6aaeaba --- /dev/null +++ b/matrix_sdk_test/test_data/sync.json @@ -0,0 +1,277 @@ +{ + "device_one_time_keys_count": {}, + "next_batch": "s526_47314_0_7_1_1_1_11444_1", + "device_lists": { + "changed": [ + "@example:example.org" + ], + "left": [] + }, + "rooms": { + "invite": {}, + "join": { + "!SVkFJHzfwvuaIEawgC:localhost": { + "summary": {}, + "account_data": { + "events": [ + { + "content": { + "event_id": "$someplace:example.org" + }, + "room_id": "!roomid:room.com", + "type": "m.fully_read" + }, + { + "content": { + "ignored_users": { + "@someone:example.org": {} + } + }, + "type": "m.ignored_user_list" + } + ] + }, + "ephemeral": { + "events": [ + { + "content": { + "$151680659217152dPKjd:localhost": { + "m.read": { + "@example:localhost": { + "ts": 1516809890615 + } + } + } + }, + "type": "m.receipt" + } + ] + }, + "state": { + "events": [ + { + "content": { + "join_rule": "public" + }, + "event_id": "$15139375514WsgmR:localhost", + "origin_server_ts": 1513937551539, + "sender": "@example:localhost", + "state_key": "", + "type": "m.room.join_rules", + "unsigned": { + "age": 7034220355 + } + }, + { + "content": { + "avatar_url": null, + "displayname": "example", + "membership": "join" + }, + "event_id": "$151800140517rfvjc:localhost", + "membership": "join", + "origin_server_ts": 1518001405556, + "sender": "@example:localhost", + "state_key": "@example:localhost", + "type": "m.room.member", + "unsigned": { + "age": 2970366338, + "replaces_state": "$151800111315tsynI:localhost" + } + }, + { + "content": { + "history_visibility": "shared" + }, + "event_id": "$15139375515VaJEY:localhost", + "origin_server_ts": 1513937551613, + "sender": "@example:localhost", + "state_key": "", + "type": "m.room.history_visibility", + "unsigned": { + "age": 7034220281 + } + }, + { + "content": { + "creator": "@example:localhost" + }, + "event_id": "$15139375510KUZHi:localhost", + "origin_server_ts": 1513937551203, + "sender": "@example:localhost", + "state_key": "", + "type": "m.room.create", + "unsigned": { + "age": 7034220691 + } + }, + { + "content": { + "aliases": [ + "#tutorial:localhost" + ] + }, + "event_id": "$15139375516NUgtD:localhost", + "origin_server_ts": 1513937551720, + "sender": "@example:localhost", + "state_key": "localhost", + "type": "m.room.aliases", + "unsigned": { + "age": 7034220174 + } + }, + { + "content": { + "topic": "\ud83d\ude00" + }, + "event_id": "$151957878228ssqrJ:localhost", + "origin_server_ts": 1519578782185, + "sender": "@example:localhost", + "state_key": "", + "type": "m.room.topic", + "unsigned": { + "age": 1392989709, + "prev_content": { + "topic": "test" + }, + "prev_sender": "@example:localhost", + "replaces_state": "$151957069225EVYKm:localhost" + } + }, + { + "content": { + "ban": 50, + "events": { + "m.room.avatar": 50, + "m.room.canonical_alias": 50, + "m.room.history_visibility": 100, + "m.room.name": 50, + "m.room.power_levels": 100 + }, + "events_default": 0, + "invite": 0, + "kick": 50, + "redact": 50, + "state_default": 50, + "users": { + "@example:localhost": 100 + }, + "users_default": 0 + }, + "event_id": "$15139375512JaHAW:localhost", + "origin_server_ts": 1513937551359, + "sender": "@example:localhost", + "state_key": "", + "type": "m.room.power_levels", + "unsigned": { + "age": 7034220535 + } + }, + { + "content": { + "alias": "#tutorial:localhost" + }, + "event_id": "$15139375513VdeRF:localhost", + "origin_server_ts": 1513937551461, + "sender": "@example:localhost", + "state_key": "", + "type": "m.room.canonical_alias", + "unsigned": { + "age": 7034220433 + } + }, + { + "content": { + "avatar_url": null, + "displayname": "example2", + "membership": "join" + }, + "event_id": "$152034824468gOeNB:localhost", + "membership": "join", + "origin_server_ts": 1520348244605, + "sender": "@example2:localhost", + "state_key": "@example2:localhost", + "type": "m.room.member", + "unsigned": { + "age": 623527289, + "prev_content": { + "membership": "leave" + }, + "prev_sender": "@example:localhost", + "replaces_state": "$152034819067QWJxM:localhost" + } + }, + { + "content": { + "membership": "leave", + "reason": "offline", + "avatar_url": "avatar.com", + "displayname": "example" + }, + "event_id": "$1585345508297748AIUBh:matrix.org", + "origin_server_ts": 1585345508223, + "sender": "@example:localhost", + "state_key": "@example:localhost", + "type": "m.room.member", + "unsigned": { + "replaces_state": "$1585345354296486IGZfp:localhost", + "prev_content": { + "avatar_url": "avatar.com", + "displayname": "example", + "membership": "join" + }, + "prev_sender": "@example2:localhost", + "age": 6992 + }, + "room_id": "!roomid:room.com" + } + ] + }, + "timeline": { + "events": [ + { + "content": { + "body": "baba", + "format": "org.matrix.custom.html", + "formatted_body": "baba", + "msgtype": "m.text" + }, + "event_id": "$152037280074GZeOm:localhost", + "origin_server_ts": 1520372800469, + "sender": "@example:localhost", + "type": "m.room.message", + "unsigned": { + "age": 598971425 + } + } + ], + "limited": true, + "prev_batch": "t392-516_47314_0_7_1_1_1_11444_1" + }, + "unread_notifications": { + "highlight_count": 0, + "notification_count": 11 + } + } + }, + "leave": {} + }, + "to_device": { + "events": [] + }, + "presence": { + "events": [ + { + "content": { + "avatar_url": "mxc://localhost:wefuiwegh8742w", + "currently_active": false, + "last_active_ago": 1, + "presence": "online", + "status_msg": "Making cupcakes" + }, + "sender": "@example:localhost", + "type": "m.presence" + } + ] + } +} diff --git a/matrix_sdk_test/test_data/sync_with_summary.json b/matrix_sdk_test/test_data/sync_with_summary.json new file mode 100644 index 00000000..f655b000 --- /dev/null +++ b/matrix_sdk_test/test_data/sync_with_summary.json @@ -0,0 +1,256 @@ +{ + "device_one_time_keys_count": {}, + "next_batch": "s526_47314_0_7_1_1_1_11444_1", + "device_lists": { + "changed": [ + "@example:example.org" + ], + "left": [] + }, + "rooms": { + "invite": {}, + "join": { + "!SVkFJHzfwvuaIEawgC:localhost": { + "summary": { + "m.heroes": [ + "@alice:example.com", + "@bob:example.com" + ], + "m.joined_member_count": 2, + "m.invited_member_count": 0 + }, + "account_data": { + "events": [ + { + "content": { + "event_id": "$someplace:example.org" + }, + "room_id": "!roomid:room.com", + "type": "m.fully_read" + }, + { + "content": { + "ignored_users": { + "@someone:example.org": {} + } + }, + "type": "m.ignored_user_list" + } + ] + }, + "ephemeral": { + "events": [ + { + "content": { + "$151680659217152dPKjd:localhost": { + "m.read": { + "@example:localhost": { + "ts": 1516809890615 + } + } + } + }, + "type": "m.receipt" + } + ] + }, + "state": { + "events": [ + { + "content": { + "join_rule": "public" + }, + "event_id": "$15139375514WsgmR:localhost", + "origin_server_ts": 1513937551539, + "sender": "@example:localhost", + "state_key": "", + "type": "m.room.join_rules", + "unsigned": { + "age": 7034220355 + } + }, + { + "content": { + "avatar_url": null, + "displayname": "example", + "membership": "join" + }, + "event_id": "$151800140517rfvjc:localhost", + "membership": "join", + "origin_server_ts": 1518001405556, + "sender": "@example:localhost", + "state_key": "@example:localhost", + "type": "m.room.member", + "unsigned": { + "age": 2970366338, + "replaces_state": "$151800111315tsynI:localhost" + } + }, + { + "content": { + "history_visibility": "shared" + }, + "event_id": "$15139375515VaJEY:localhost", + "origin_server_ts": 1513937551613, + "sender": "@example:localhost", + "state_key": "", + "type": "m.room.history_visibility", + "unsigned": { + "age": 7034220281 + } + }, + { + "content": { + "creator": "@example:localhost" + }, + "event_id": "$15139375510KUZHi:localhost", + "origin_server_ts": 1513937551203, + "sender": "@example:localhost", + "state_key": "", + "type": "m.room.create", + "unsigned": { + "age": 7034220691 + } + }, + { + "content": { + "topic": "\ud83d\ude00" + }, + "event_id": "$151957878228ssqrJ:localhost", + "origin_server_ts": 1519578782185, + "sender": "@example:localhost", + "state_key": "", + "type": "m.room.topic", + "unsigned": { + "age": 1392989709, + "prev_content": { + "topic": "test" + }, + "prev_sender": "@example:localhost", + "replaces_state": "$151957069225EVYKm:localhost" + } + }, + { + "content": { + "ban": 50, + "events": { + "m.room.avatar": 50, + "m.room.canonical_alias": 50, + "m.room.history_visibility": 100, + "m.room.name": 50, + "m.room.power_levels": 100 + }, + "events_default": 0, + "invite": 0, + "kick": 50, + "redact": 50, + "state_default": 50, + "users": { + "@example:localhost": 100 + }, + "users_default": 0 + }, + "event_id": "$15139375512JaHAW:localhost", + "origin_server_ts": 1513937551359, + "sender": "@example:localhost", + "state_key": "", + "type": "m.room.power_levels", + "unsigned": { + "age": 7034220535 + } + }, + { + "content": { + "avatar_url": null, + "displayname": "example2", + "membership": "join" + }, + "event_id": "$152034824468gOeNB:localhost", + "membership": "join", + "origin_server_ts": 1520348244605, + "sender": "@example2:localhost", + "state_key": "@example2:localhost", + "type": "m.room.member", + "unsigned": { + "age": 623527289, + "prev_content": { + "membership": "leave" + }, + "prev_sender": "@example:localhost", + "replaces_state": "$152034819067QWJxM:localhost" + } + }, + { + "content": { + "membership": "leave", + "reason": "offline", + "avatar_url": "avatar.com", + "displayname": "example" + }, + "event_id": "$1585345508297748AIUBh:matrix.org", + "origin_server_ts": 1585345508223, + "sender": "@example:localhost", + "state_key": "@example:localhost", + "type": "m.room.member", + "unsigned": { + "replaces_state": "$1585345354296486IGZfp:localhost", + "prev_content": { + "avatar_url": "avatar.com", + "displayname": "example", + "membership": "join" + }, + "prev_sender": "@example2:localhost", + "age": 6992 + }, + "room_id": "!roomid:room.com" + } + ] + }, + "timeline": { + "events": [ + { + "content": { + "body": "baba", + "format": "org.matrix.custom.html", + "formatted_body": "baba", + "msgtype": "m.text" + }, + "event_id": "$152037280074GZeOm:localhost", + "origin_server_ts": 1520372800469, + "sender": "@example:localhost", + "type": "m.room.message", + "unsigned": { + "age": 598971425 + } + } + ], + "limited": true, + "prev_batch": "t392-516_47314_0_7_1_1_1_11444_1" + }, + "unread_notifications": { + "highlight_count": 0, + "notification_count": 11 + } + } + }, + "leave": {} + }, + "to_device": { + "events": [] + }, + "presence": { + "events": [ + { + "content": { + "avatar_url": "mxc://localhost:wefuiwegh8742w", + "currently_active": false, + "last_active_ago": 1, + "presence": "online", + "status_msg": "Making cupcakes" + }, + "sender": "@example:localhost", + "type": "m.presence" + } + ] + } +} diff --git a/matrix_sdk_test/test_data/upload_response.json b/matrix_sdk_test/test_data/upload_response.json new file mode 100644 index 00000000..24845bf9 --- /dev/null +++ b/matrix_sdk_test/test_data/upload_response.json @@ -0,0 +1,3 @@ +{ + "content_uri": "mxc://example.com/AQwafuaFswefuhsfAFAgsw" +}