summary refs log tree commit diff
path: root/tests/rest/client
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2020-02-18 23:15:54 +0000
committerRichard van der Hoff <richard@matrix.org>2020-02-19 08:53:32 +0000
commit709e81f5183d8ff67d86f4569234cb4a8be7a8d4 (patch)
tree6b899ab71d6cc319515646169c813ab492c4bd97 /tests/rest/client
parentAdd `allow_departed_users` param to `check_in_room_or_world_readable` (diff)
downloadsynapse-709e81f5183d8ff67d86f4569234cb4a8be7a8d4.tar.xz
Make room alias lists peekable
As per
https://github.com/matrix-org/matrix-doc/pull/2432#pullrequestreview-360566830,
make room alias lists accessible to users outside world_readable rooms.
Diffstat (limited to 'tests/rest/client')
-rw-r--r--tests/rest/client/v1/test_rooms.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/rest/client/v1/test_rooms.py b/tests/rest/client/v1/test_rooms.py
index fb08a45d27..8e389eb6c9 100644
--- a/tests/rest/client/v1/test_rooms.py
+++ b/tests/rest/client/v1/test_rooms.py
@@ -1766,6 +1766,23 @@ class DirectoryTestCase(unittest.HomeserverTestCase):
         res = self._get_aliases(self.room_owner_tok)
         self.assertEqual(set(res["aliases"]), {alias1, alias2})
 
+    def test_peekable_room(self):
+        alias1 = self._random_alias()
+        self._set_alias_via_directory(alias1)
+
+        self.helper.send_state(
+            self.room_id,
+            EventTypes.RoomHistoryVisibility,
+            body={"history_visibility": "world_readable"},
+            tok=self.room_owner_tok,
+        )
+
+        self.register_user("user", "test")
+        user_tok = self.login("user", "test")
+
+        res = self._get_aliases(user_tok)
+        self.assertEqual(res["aliases"], [alias1])
+
     def _get_aliases(self, access_token: str, expected_code: int = 200) -> JsonDict:
         """Calls the endpoint under test. returns the json response object."""
         request, channel = self.make_request(