summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorDeepBlueV7.X <nicolas.werner@hotmail.de>2022-05-05 14:25:00 +0000
committerGitHub <noreply@github.com>2022-05-05 15:25:00 +0100
commita377a43386a14c8a11fe9e99c821d0471f7982a2 (patch)
treefd363df50e1efe9a76c8e80759ea582615a485b4 /tests
parentUpdate `_on_new_receipts()` to work with MSC2285 changes. (#12636) (diff)
downloadsynapse-a377a43386a14c8a11fe9e99c821d0471f7982a2.tar.xz
Support MSC3266 room summaries over federation (#11507)
Signed-off-by: Nicolas Werner <nicolas.werner@hotmail.de>
Diffstat (limited to 'tests')
-rw-r--r--tests/handlers/test_room_summary.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/handlers/test_room_summary.py b/tests/handlers/test_room_summary.py
index d37292ce13..e74eb71774 100644
--- a/tests/handlers/test_room_summary.py
+++ b/tests/handlers/test_room_summary.py
@@ -1092,3 +1092,29 @@ class RoomSummaryTestCase(unittest.HomeserverTestCase):
         )
         result = self.get_success(self.handler.get_room_summary(user2, self.room))
         self.assertEqual(result.get("room_id"), self.room)
+
+    def test_fed(self):
+        """
+        Return data over federation and ensure that it is handled properly.
+        """
+        fed_hostname = self.hs.hostname + "2"
+        fed_room = "#fed_room:" + fed_hostname
+
+        requested_room_entry = _RoomEntry(
+            fed_room,
+            {"room_id": fed_room, "world_readable": True},
+        )
+
+        async def summarize_remote_room_hierarchy(_self, room, suggested_only):
+            return requested_room_entry, {}, set()
+
+        with mock.patch(
+            "synapse.handlers.room_summary.RoomSummaryHandler._summarize_remote_room_hierarchy",
+            new=summarize_remote_room_hierarchy,
+        ):
+            result = self.get_success(
+                self.handler.get_room_summary(
+                    self.user, fed_room, remote_room_hosts=[fed_hostname]
+                )
+            )
+        self.assertEqual(result.get("room_id"), fed_room)