Ejemplo n.º 1
0
 def sync_response(self):
     timeline = Timeline([
         RoomMemberEvent(
             {
                 "event_id": "event_id_1",
                 "sender": ALICE_ID,
                 "origin_server_ts": 1516809890615
             }, ALICE_ID, "join", None, {"membership": "join"}),
         RoomEncryptionEvent({
             "event_id": "event_id_2",
             "sender": ALICE_ID,
             "origin_server_ts": 1516809890615
         })
     ], False, "prev_batch_token")
     test_room_info = RoomInfo(timeline, [],
                               [TypingNoticeEvent([ALICE_ID])], [],
                               RoomSummary(1, 2, []))
     rooms = Rooms({}, {TEST_ROOM_ID: test_room_info}, {})
     return SyncResponse("token123", rooms, DeviceOneTimeKeyCount(
         49, 50), DeviceList([ALICE_ID], []), [
             RoomEncryptionEvent({
                 "event_id": "event_id_2",
                 "sender": ALICE_ID,
                 "origin_server_ts": 1516809890615
             })
         ])
Ejemplo n.º 2
0
 def downgrade_sync(self):
     timeline = Timeline([
         RoomMemberEvent("event_id_1", ALICE_ID, 1516809890615, ALICE_ID,
                         {"membership": "join"}),
     ], False, "prev_batch_token")
     test_room_info = RoomInfo(timeline, [], [], [], RoomSummary(1, 2, []))
     rooms = Rooms({}, {TEST_ROOM_ID: test_room_info}, {})
     return SyncResponse("token123", rooms, DeviceOneTimeKeyCount(49, 50),
                         DeviceList([ALICE_ID], []), [])
Ejemplo n.º 3
0
 def sync_response(self):
     timeline = Timeline([
         RoomMemberEvent(
             {
                 "event_id": "event_id_1",
                 "sender": ALICE_ID,
                 "origin_server_ts": 1516809890615
             }, ALICE_ID, "join", None, {"membership": "join"}),
         RoomMemberEvent(
             {
                 "event_id": "event_id_2",
                 "sender": ALICE_ID,
                 "origin_server_ts": 1516809890615
             },
             CAROL_ID,
             "invite",
             None,
             {"membership": "invite"},
         ),
         RoomEncryptionEvent({
             "event_id": "event_id_3",
             "sender": ALICE_ID,
             "origin_server_ts": 1516809890615
         })
     ], False, "prev_batch_token")
     test_room_info = RoomInfo(
         timeline,
         [],
         [
             TypingNoticeEvent([ALICE_ID]),
             ReceiptEvent([
                 Receipt(event_id="event_id_3",
                         receipt_type="m.read",
                         user_id=ALICE_ID,
                         timestamp=1516809890615)
             ])
         ],
         [],
         RoomSummary(invited_member_count=1, joined_member_count=2),
     )
     rooms = Rooms({}, {TEST_ROOM_ID: test_room_info}, {})
     return SyncResponse("token123", rooms, DeviceOneTimeKeyCount(
         49, 50), DeviceList([ALICE_ID], []), [
             RoomEncryptionEvent({
                 "event_id": "event_id_2",
                 "sender": ALICE_ID,
                 "origin_server_ts": 1516809890615
             })
         ])
Ejemplo n.º 4
0
 def sync_response(self):
     timeline = Timeline([
         RoomMemberEvent(
             {
                 "event_id": "event_id_1",
                 "sender": ALICE_ID,
                 "origin_server_ts": 1516809890615
             }, ALICE_ID, "join", None, {"membership": "join"}),
         RoomMemberEvent(
             {
                 "event_id": "event_id_2",
                 "sender": ALICE_ID,
                 "origin_server_ts": 1516809890615
             },
             CAROL_ID,
             "invite",
             None,
             {"membership": "invite"},
         ),
         RoomEncryptionEvent({
             "event_id": "event_id_3",
             "sender": ALICE_ID,
             "origin_server_ts": 1516809890615
         })
     ], False, "prev_batch_token")
     test_room_info = RoomInfo(
         timeline=timeline,
         state=[],
         ephemeral=[
             TypingNoticeEvent([ALICE_ID]),
             ReceiptEvent([
                 Receipt(event_id="event_id_3",
                         receipt_type="m.read",
                         user_id=ALICE_ID,
                         timestamp=1516809890615)
             ])
         ],
         account_data=[
             FullyReadEvent(event_id="event_id_2"),
             TagEvent(tags={"u.test": {
                 "order": 1
             }}),
         ],
         summary=RoomSummary(
             invited_member_count=1,
             joined_member_count=2,
         ),
     )
     rooms = Rooms(invite={}, join={TEST_ROOM_ID: test_room_info}, leave={})
     return SyncResponse(next_batch="token123",
                         rooms=rooms,
                         device_key_count=DeviceOneTimeKeyCount(49, 50),
                         device_list=DeviceList([ALICE_ID], []),
                         to_device_events=[
                             RoomEncryptionEvent({
                                 "event_id":
                                 "event_id_2",
                                 "sender":
                                 ALICE_ID,
                                 "origin_server_ts":
                                 1516809890615
                             })
                         ],
                         presence_events=[
                             PresenceEvent(ALICE_ID, "online", 1337, True,
                                           "I am here.")
                         ])