summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorEric Eastwood <eric.eastwood@beta.gouv.fr>2024-07-11 18:19:26 -0500
committerGitHub <noreply@github.com>2024-07-11 18:19:26 -0500
commitfb66e938b26e96384af5a72c71ed7d9dec12f1a2 (patch)
treee3d4d1091989c6899d5e9d9231fbe6a99ecea266 /tests
parentAdd `heroes` and room summary fields to Sliding Sync `/sync` (#17419) (diff)
downloadsynapse-fb66e938b26e96384af5a72c71ed7d9dec12f1a2.tar.xz
Add `is_dm` room field to Sliding Sync `/sync` (#17429)
Based on
[MSC3575](https://github.com/matrix-org/matrix-spec-proposals/pull/3575):
Sliding Sync
Diffstat (limited to 'tests')
-rw-r--r--tests/rest/client/test_sync.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/rest/client/test_sync.py b/tests/rest/client/test_sync.py
index 0d0bea538b..4236812db5 100644
--- a/tests/rest/client/test_sync.py
+++ b/tests/rest/client/test_sync.py
@@ -1662,6 +1662,20 @@ class SlidingSyncTestCase(unittest.HomeserverTestCase):
             list(channel.json_body["lists"]["room-invites"]),
         )
 
+        # Ensure DM's are correctly marked
+        self.assertDictEqual(
+            {
+                room_id: room.get("is_dm")
+                for room_id, room in channel.json_body["rooms"].items()
+            },
+            {
+                invite_room_id: None,
+                room_id: None,
+                invited_dm_room_id: True,
+                joined_dm_room_id: True,
+            },
+        )
+
     def test_sort_list(self) -> None:
         """
         Test that the `lists` are sorted by `stream_ordering`
@@ -1874,6 +1888,9 @@ class SlidingSyncTestCase(unittest.HomeserverTestCase):
             channel.json_body["rooms"][room_id1]["invited_count"],
             0,
         )
+        self.assertIsNone(
+            channel.json_body["rooms"][room_id1].get("is_dm"),
+        )
 
     def test_rooms_meta_when_invited(self) -> None:
         """
@@ -1955,6 +1972,9 @@ class SlidingSyncTestCase(unittest.HomeserverTestCase):
             channel.json_body["rooms"][room_id1]["invited_count"],
             1,
         )
+        self.assertIsNone(
+            channel.json_body["rooms"][room_id1].get("is_dm"),
+        )
 
     def test_rooms_meta_when_banned(self) -> None:
         """
@@ -2037,6 +2057,9 @@ class SlidingSyncTestCase(unittest.HomeserverTestCase):
             channel.json_body["rooms"][room_id1]["invited_count"],
             0,
         )
+        self.assertIsNone(
+            channel.json_body["rooms"][room_id1].get("is_dm"),
+        )
 
     def test_rooms_meta_heroes(self) -> None:
         """