summary refs log tree commit diff
path: root/tests/rest/admin/test_room.py
diff options
context:
space:
mode:
authorAzrenbeth <7782548+Azrenbeth@users.noreply.github.com>2021-09-28 16:15:58 +0100
committerAzrenbeth <7782548+Azrenbeth@users.noreply.github.com>2021-09-28 16:15:58 +0100
commitdb6cc8f35b739b4db84a58f5226f79e6fad61978 (patch)
treed76d4fa3f80eda9d28b999fab5e1cfc349da09c7 /tests/rest/admin/test_room.py
parentTidy up documentation a bit (diff)
parentDrop backwards-compatibility support for "outlier" (#10903) (diff)
downloadsynapse-db6cc8f35b739b4db84a58f5226f79e6fad61978.tar.xz
Merge remote-tracking branch 'origin/develop' into azren/compressor_integration
Diffstat (limited to 'tests/rest/admin/test_room.py')
-rw-r--r--tests/rest/admin/test_room.py29
1 files changed, 28 insertions, 1 deletions
diff --git a/tests/rest/admin/test_room.py b/tests/rest/admin/test_room.py

index 40e032df7f..0fa55e03b4 100644 --- a/tests/rest/admin/test_room.py +++ b/tests/rest/admin/test_room.py
@@ -47,7 +47,7 @@ class DeleteRoomTestCase(unittest.HomeserverTestCase): def prepare(self, reactor, clock, hs): self.event_creation_handler = hs.get_event_creation_handler() - hs.config.user_consent_version = "1" + hs.config.consent.user_consent_version = "1" consent_uri_builder = Mock() consent_uri_builder.build_user_consent_uri.return_value = "http://example.com" @@ -941,6 +941,33 @@ class RoomTestCase(unittest.HomeserverTestCase): _search_test(None, "bar") _search_test(None, "", expected_http_code=400) + def test_search_term_non_ascii(self): + """Test that searching for a room with non-ASCII characters works correctly""" + + # Create test room + room_id = self.helper.create_room_as(self.admin_user, tok=self.admin_user_tok) + room_name = "ж" + + # Set the name for the room + self.helper.send_state( + room_id, + "m.room.name", + {"name": room_name}, + tok=self.admin_user_tok, + ) + + # make the request and test that the response is what we wanted + search_term = urllib.parse.quote("ж", "utf-8") + url = "/_synapse/admin/v1/rooms?search_term=%s" % (search_term,) + channel = self.make_request( + "GET", + url.encode("ascii"), + access_token=self.admin_user_tok, + ) + self.assertEqual(200, channel.code, msg=channel.json_body) + self.assertEqual(room_id, channel.json_body.get("rooms")[0].get("room_id")) + self.assertEqual("ж", channel.json_body.get("rooms")[0].get("name")) + def test_single_room(self): """Test that a single room can be requested correctly""" # Create two test rooms