summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorPaul "LeoNerd" Evans <paul@matrix.org>2014-11-18 15:28:58 +0000
committerPaul "LeoNerd" Evans <paul@matrix.org>2014-11-18 15:28:58 +0000
commit33d328d967341d8819632bc3c5406b8c54f54504 (patch)
treec170a1bd70dfb9250b0b493387b4ae36433c5857 /tests
parentAdded ability to .get_state() from the PresenceHandler by returning a complet... (diff)
downloadsynapse-33d328d967341d8819632bc3c5406b8c54f54504.tar.xz
Include room members' presence in room initialSync
Diffstat (limited to 'tests')
-rw-r--r--tests/rest/test_rooms.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/rest/test_rooms.py b/tests/rest/test_rooms.py
index b7d9a2bd06..ad3631d510 100644
--- a/tests/rest/test_rooms.py
+++ b/tests/rest/test_rooms.py
@@ -1026,6 +1026,12 @@ class RoomInitialSyncTestCase(RestTestCase):
 
         synapse.rest.room.register_servlets(hs, self.mock_resource)
 
+        # Since I'm getting my own presence I need to exist as far as presence
+        # is concerned.
+        hs.get_handlers().presence_handler.registered_user(
+            hs.parse_userid(self.user_id)
+        )
+
         # create the room
         self.room_id = yield self.create_room_as(self.user_id)
 
@@ -1054,6 +1060,14 @@ class RoomInitialSyncTestCase(RestTestCase):
         self.assertTrue("chunk" in response["messages"])
         self.assertTrue("end" in response["messages"])
 
+        self.assertTrue("presence" in response)
+
+        presence_by_user = {e["content"]["user_id"]: e
+            for e in response["presence"]
+        }
+        self.assertTrue(self.user_id in presence_by_user)
+        self.assertEquals("m.presence", presence_by_user[self.user_id]["type"])
+
 #        (code, response) = yield self.mock_resource.trigger("GET", path, None)
 #        self.assertEquals(200, code, msg=str(response))
 #        self.assert_dict(json.loads(content), response)