From 5107fd4a6cf104e168d916572e260fdd7bc83e25 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Fri, 11 Sep 2020 14:18:05 +0100 Subject: [PATCH] Test that an unrestricted room cannot be published to the public room dir --- tests/rest/client/test_room_access_rules.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/rest/client/test_room_access_rules.py b/tests/rest/client/test_room_access_rules.py index fe8aad67e0..a8ceea8b1d 100644 --- a/tests/rest/client/test_room_access_rules.py +++ b/tests/rest/client/test_room_access_rules.py @@ -343,6 +343,9 @@ def test_unrestricted(self): """Tests that, in unrestricted mode, we can invite whoever we want, but we can only change the power level of users that wouldn't be forbidden in restricted mode. + + Additionally tests that the room cannot be published to the public rooms + directory. """ # We can invite self.helper.invite( @@ -409,6 +412,14 @@ def test_unrestricted(self): expect_code=403, ) + # We can't publish the room to the public rooms directory + url = "/_matrix/client/r0/directory/list/room/%s" % self.unrestricted_room + data = {"visibility": "public"} + + request, channel = self.make_request("PUT", url, data, access_token=self.tok) + self.render(request) + self.assertEqual(channel.code, 400, channel.result) + def test_change_rules(self): """Tests that we can only change the current rule from restricted to unrestricted.