summary refs log tree commit diff
path: root/tests/rest/client
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/rest/client/__init__.py1
-rw-r--r--tests/rest/client/test_account.py1
-rw-r--r--tests/rest/client/test_account_data.py1
-rw-r--r--tests/rest/client/test_auth.py1
-rw-r--r--tests/rest/client/test_devices.py1
-rw-r--r--tests/rest/client/test_events.py1
-rw-r--r--tests/rest/client/test_filter.py1
-rw-r--r--tests/rest/client/test_keys.py1
-rw-r--r--tests/rest/client/test_login.py1
-rw-r--r--tests/rest/client/test_login_token_request.py1
-rw-r--r--tests/rest/client/test_models.py1
-rw-r--r--tests/rest/client/test_mutual_rooms.py1
-rw-r--r--tests/rest/client/test_notifications.py1
-rw-r--r--tests/rest/client/test_password_policy.py1
-rw-r--r--tests/rest/client/test_power_levels.py1
-rw-r--r--tests/rest/client/test_profile.py1
-rw-r--r--tests/rest/client/test_push_rule_attrs.py1
-rw-r--r--tests/rest/client/test_read_marker.py1
-rw-r--r--tests/rest/client/test_receipts.py1
-rw-r--r--tests/rest/client/test_redactions.py1
-rw-r--r--tests/rest/client/test_register.py2
-rw-r--r--tests/rest/client/test_relations.py1
-rw-r--r--tests/rest/client/test_rendezvous.py1
-rw-r--r--tests/rest/client/test_report_event.py1
-rw-r--r--tests/rest/client/test_rooms.py30
-rw-r--r--tests/rest/client/test_sendtodevice.py1
-rw-r--r--tests/rest/client/test_shadow_banned.py1
-rw-r--r--tests/rest/client/test_sync.py1
-rw-r--r--tests/rest/client/test_third_party_rules.py1
-rw-r--r--tests/rest/client/test_transactions.py1
-rw-r--r--tests/rest/client/test_typing.py1
-rw-r--r--tests/rest/client/test_upgrade_room.py1
-rw-r--r--tests/rest/client/utils.py6
33 files changed, 67 insertions, 1 deletions
diff --git a/tests/rest/client/__init__.py b/tests/rest/client/__init__.py

index 3d833a2e44..6a72062b0c 100644 --- a/tests/rest/client/__init__.py +++ b/tests/rest/client/__init__.py
@@ -1,6 +1,7 @@ # # This file is licensed under the Affero General Public License (AGPL) version 3. # +# Copyright 2015, 2016 OpenMarket Ltd # Copyright (C) 2023 New Vector, Ltd # # This program is free software: you can redistribute it and/or modify diff --git a/tests/rest/client/test_account.py b/tests/rest/client/test_account.py
index f1e4bdea76..992421ffe2 100644 --- a/tests/rest/client/test_account.py +++ b/tests/rest/client/test_account.py
@@ -1,6 +1,7 @@ # # This file is licensed under the Affero General Public License (AGPL) version 3. # +# Copyright 2022 The Matrix.org Foundation C.I.C. # Copyright (C) 2023 New Vector, Ltd # # This program is free software: you can redistribute it and/or modify diff --git a/tests/rest/client/test_account_data.py b/tests/rest/client/test_account_data.py
index ce505eef62..be6d7af2fc 100644 --- a/tests/rest/client/test_account_data.py +++ b/tests/rest/client/test_account_data.py
@@ -1,6 +1,7 @@ # # This file is licensed under the Affero General Public License (AGPL) version 3. # +# Copyright 2022 The Matrix.org Foundation C.I.C # Copyright (C) 2023 New Vector, Ltd # # This program is free software: you can redistribute it and/or modify diff --git a/tests/rest/client/test_auth.py b/tests/rest/client/test_auth.py
index 8bc36209e5..0b5daf4bb4 100644 --- a/tests/rest/client/test_auth.py +++ b/tests/rest/client/test_auth.py
@@ -1,6 +1,7 @@ # # This file is licensed under the Affero General Public License (AGPL) version 3. # +# Copyright 2020-2021 The Matrix.org Foundation C.I.C # Copyright (C) 2023 New Vector, Ltd # # This program is free software: you can redistribute it and/or modify diff --git a/tests/rest/client/test_devices.py b/tests/rest/client/test_devices.py
index f1cfe0df91..2b360732ac 100644 --- a/tests/rest/client/test_devices.py +++ b/tests/rest/client/test_devices.py
@@ -1,6 +1,7 @@ # # This file is licensed under the Affero General Public License (AGPL) version 3. # +# Copyright 2022 The Matrix.org Foundation C.I.C. # Copyright (C) 2023 New Vector, Ltd # # This program is free software: you can redistribute it and/or modify diff --git a/tests/rest/client/test_events.py b/tests/rest/client/test_events.py
index c456b24839..06f1c1b234 100644 --- a/tests/rest/client/test_events.py +++ b/tests/rest/client/test_events.py
@@ -1,6 +1,7 @@ # # This file is licensed under the Affero General Public License (AGPL) version 3. # +# Copyright 2014-2016 OpenMarket Ltd # Copyright (C) 2023 New Vector, Ltd # # This program is free software: you can redistribute it and/or modify diff --git a/tests/rest/client/test_filter.py b/tests/rest/client/test_filter.py
index b3b108dd5e..0a894ad081 100644 --- a/tests/rest/client/test_filter.py +++ b/tests/rest/client/test_filter.py
@@ -1,6 +1,7 @@ # # This file is licensed under the Affero General Public License (AGPL) version 3. # +# Copyright 2015, 2016 OpenMarket Ltd # Copyright (C) 2023 New Vector, Ltd # # This program is free software: you can redistribute it and/or modify diff --git a/tests/rest/client/test_keys.py b/tests/rest/client/test_keys.py
index e99160c5ac..5f0c005576 100644 --- a/tests/rest/client/test_keys.py +++ b/tests/rest/client/test_keys.py
@@ -1,6 +1,7 @@ # # This file is licensed under the Affero General Public License (AGPL) version 3. # +# Copyright 2021 The Matrix.org Foundation C.I.C. # Copyright (C) 2023 New Vector, Ltd # # This program is free software: you can redistribute it and/or modify diff --git a/tests/rest/client/test_login.py b/tests/rest/client/test_login.py
index 42610308d5..3d3a7b0aa7 100644 --- a/tests/rest/client/test_login.py +++ b/tests/rest/client/test_login.py
@@ -1,6 +1,7 @@ # # This file is licensed under the Affero General Public License (AGPL) version 3. # +# Copyright 2019-2021 The Matrix.org Foundation C.I.C. # Copyright (C) 2023 New Vector, Ltd # # This program is free software: you can redistribute it and/or modify diff --git a/tests/rest/client/test_login_token_request.py b/tests/rest/client/test_login_token_request.py
index 2913679c8b..fbacf9d869 100644 --- a/tests/rest/client/test_login_token_request.py +++ b/tests/rest/client/test_login_token_request.py
@@ -1,6 +1,7 @@ # # This file is licensed under the Affero General Public License (AGPL) version 3. # +# Copyright 2022 The Matrix.org Foundation C.I.C. # Copyright (C) 2023 New Vector, Ltd # # This program is free software: you can redistribute it and/or modify diff --git a/tests/rest/client/test_models.py b/tests/rest/client/test_models.py
index 99d0feb10d..534dd7bcf4 100644 --- a/tests/rest/client/test_models.py +++ b/tests/rest/client/test_models.py
@@ -1,6 +1,7 @@ # # This file is licensed under the Affero General Public License (AGPL) version 3. # +# Copyright 2022 The Matrix.org Foundation C.I.C. # Copyright (C) 2023 New Vector, Ltd # # This program is free software: you can redistribute it and/or modify diff --git a/tests/rest/client/test_mutual_rooms.py b/tests/rest/client/test_mutual_rooms.py
index e25f4e4175..637722ca0a 100644 --- a/tests/rest/client/test_mutual_rooms.py +++ b/tests/rest/client/test_mutual_rooms.py
@@ -1,6 +1,7 @@ # # This file is licensed under the Affero General Public License (AGPL) version 3. # +# Copyright 2020 Half-Shot # Copyright (C) 2023 New Vector, Ltd # # This program is free software: you can redistribute it and/or modify diff --git a/tests/rest/client/test_notifications.py b/tests/rest/client/test_notifications.py
index 8f1cbcd5db..e9aa2e450e 100644 --- a/tests/rest/client/test_notifications.py +++ b/tests/rest/client/test_notifications.py
@@ -1,6 +1,7 @@ # # This file is licensed under the Affero General Public License (AGPL) version 3. # +# Copyright 2022 The Matrix.org Foundation C.I.C. # Copyright (C) 2023 New Vector, Ltd # # This program is free software: you can redistribute it and/or modify diff --git a/tests/rest/client/test_password_policy.py b/tests/rest/client/test_password_policy.py
index 08d1cf56f2..f0ef733f7b 100644 --- a/tests/rest/client/test_password_policy.py +++ b/tests/rest/client/test_password_policy.py
@@ -1,6 +1,7 @@ # # This file is licensed under the Affero General Public License (AGPL) version 3. # +# Copyright 2019 The Matrix.org Foundation C.I.C. # Copyright (C) 2023 New Vector, Ltd # # This program is free software: you can redistribute it and/or modify diff --git a/tests/rest/client/test_power_levels.py b/tests/rest/client/test_power_levels.py
index 634cda9262..1584c2e96c 100644 --- a/tests/rest/client/test_power_levels.py +++ b/tests/rest/client/test_power_levels.py
@@ -1,6 +1,7 @@ # # This file is licensed under the Affero General Public License (AGPL) version 3. # +# Copyright 2020 The Matrix.org Foundation C.I.C. # Copyright (C) 2023 New Vector, Ltd # # This program is free software: you can redistribute it and/or modify diff --git a/tests/rest/client/test_profile.py b/tests/rest/client/test_profile.py
index b9852928c0..f98f3f77aa 100644 --- a/tests/rest/client/test_profile.py +++ b/tests/rest/client/test_profile.py
@@ -1,6 +1,7 @@ # # This file is licensed under the Affero General Public License (AGPL) version 3. # +# Copyright 2014-2016 OpenMarket Ltd # Copyright (C) 2023 New Vector, Ltd # # This program is free software: you can redistribute it and/or modify diff --git a/tests/rest/client/test_push_rule_attrs.py b/tests/rest/client/test_push_rule_attrs.py
index 0ee66b6a84..9da0e7982f 100644 --- a/tests/rest/client/test_push_rule_attrs.py +++ b/tests/rest/client/test_push_rule_attrs.py
@@ -1,6 +1,7 @@ # # This file is licensed under the Affero General Public License (AGPL) version 3. # +# Copyright 2020 The Matrix.org Foundation C.I.C. # Copyright (C) 2023 New Vector, Ltd # # This program is free software: you can redistribute it and/or modify diff --git a/tests/rest/client/test_read_marker.py b/tests/rest/client/test_read_marker.py
index ed0ac2af6e..2fe350e1e8 100644 --- a/tests/rest/client/test_read_marker.py +++ b/tests/rest/client/test_read_marker.py
@@ -1,6 +1,7 @@ # # This file is licensed under the Affero General Public License (AGPL) version 3. # +# Copyright 2023 Beeper # Copyright (C) 2023 New Vector, Ltd # # This program is free software: you can redistribute it and/or modify diff --git a/tests/rest/client/test_receipts.py b/tests/rest/client/test_receipts.py
index 9fe49a12f6..f0648289f1 100644 --- a/tests/rest/client/test_receipts.py +++ b/tests/rest/client/test_receipts.py
@@ -1,6 +1,7 @@ # # This file is licensed under the Affero General Public License (AGPL) version 3. # +# Copyright 2022 The Matrix.org Foundation C.I.C. # Copyright (C) 2023 New Vector, Ltd # # This program is free software: you can redistribute it and/or modify diff --git a/tests/rest/client/test_redactions.py b/tests/rest/client/test_redactions.py
index 2afb3f065a..b25e184786 100644 --- a/tests/rest/client/test_redactions.py +++ b/tests/rest/client/test_redactions.py
@@ -1,6 +1,7 @@ # # This file is licensed under the Affero General Public License (AGPL) version 3. # +# Copyright 2019 The Matrix.org Foundation C.I.C. # Copyright (C) 2023 New Vector, Ltd # # This program is free software: you can redistribute it and/or modify diff --git a/tests/rest/client/test_register.py b/tests/rest/client/test_register.py
index 13f27d13c9..859051cdda 100644 --- a/tests/rest/client/test_register.py +++ b/tests/rest/client/test_register.py
@@ -1,6 +1,8 @@ # # This file is licensed under the Affero General Public License (AGPL) version 3. # +# Copyright 2019 The Matrix.org Foundation C.I.C. +# Copyright 2014-2016 OpenMarket Ltd # Copyright (C) 2023 New Vector, Ltd # # This program is free software: you can redistribute it and/or modify diff --git a/tests/rest/client/test_relations.py b/tests/rest/client/test_relations.py
index e0529d88c5..c05b3fc781 100644 --- a/tests/rest/client/test_relations.py +++ b/tests/rest/client/test_relations.py
@@ -1,6 +1,7 @@ # # This file is licensed under the Affero General Public License (AGPL) version 3. # +# Copyright 2021 The Matrix.org Foundation C.I.C. # Copyright (C) 2023 New Vector, Ltd # # This program is free software: you can redistribute it and/or modify diff --git a/tests/rest/client/test_rendezvous.py b/tests/rest/client/test_rendezvous.py
index 07e45f14f9..294b39f179 100644 --- a/tests/rest/client/test_rendezvous.py +++ b/tests/rest/client/test_rendezvous.py
@@ -1,6 +1,7 @@ # # This file is licensed under the Affero General Public License (AGPL) version 3. # +# Copyright 2022 The Matrix.org Foundation C.I.C. # Copyright (C) 2023 New Vector, Ltd # # This program is free software: you can redistribute it and/or modify diff --git a/tests/rest/client/test_report_event.py b/tests/rest/client/test_report_event.py
index 41c03b6f68..5903771e52 100644 --- a/tests/rest/client/test_report_event.py +++ b/tests/rest/client/test_report_event.py
@@ -1,6 +1,7 @@ # # This file is licensed under the Affero General Public License (AGPL) version 3. # +# Copyright 2021 Callum Brown # Copyright (C) 2023 New Vector, Ltd # # This program is free software: you can redistribute it and/or modify diff --git a/tests/rest/client/test_rooms.py b/tests/rest/client/test_rooms.py
index 0e71cdcd88..b11a73e92b 100644 --- a/tests/rest/client/test_rooms.py +++ b/tests/rest/client/test_rooms.py
@@ -1,6 +1,9 @@ # # This file is licensed under the Affero General Public License (AGPL) version 3. # +# Copyright 2019 The Matrix.org Foundation C.I.C. +# Copyright 2017 Vector Creations Ltd +# Copyright 2014-2016 OpenMarket Ltd # Copyright (C) 2023 New Vector, Ltd # # This program is free software: you can redistribute it and/or modify @@ -2155,6 +2158,33 @@ class RoomMessageListTestCase(RoomBase): self.assertEqual(len(chunk), 0, [event["content"] for event in chunk]) +class RoomMessageFilterTestCase(RoomBase): + """Tests /rooms/$room_id/messages REST events.""" + + user_id = "@sid1:red" + + def prepare(self, reactor: MemoryReactor, clock: Clock, hs: HomeServer) -> None: + self.room_id = self.helper.create_room_as(self.user_id) + + def test_room_message_filter_wildcard(self) -> None: + # Send a first message in the room, which will be removed by the purge. + self.helper.send(self.room_id, "message 1", type="f.message.1") + self.helper.send(self.room_id, "message 1", type="f.message.2") + self.helper.send(self.room_id, "not returned in filter") + channel = self.make_request( + "GET", + "/rooms/%s/messages?access_token=x&dir=b&filter=%s" + % ( + self.room_id, + json.dumps({"types": ["f.message.*"]}), + ), + ) + self.assertEqual(channel.code, HTTPStatus.OK, channel.json_body) + + chunk = channel.json_body["chunk"] + self.assertEqual(len(chunk), 2, [event["content"] for event in chunk]) + + class RoomSearchTestCase(unittest.HomeserverTestCase): servlets = [ synapse.rest.admin.register_servlets_for_client_rest_resource, diff --git a/tests/rest/client/test_sendtodevice.py b/tests/rest/client/test_sendtodevice.py
index 0a7676e566..2f994ad553 100644 --- a/tests/rest/client/test_sendtodevice.py +++ b/tests/rest/client/test_sendtodevice.py
@@ -1,6 +1,7 @@ # # This file is licensed under the Affero General Public License (AGPL) version 3. # +# Copyright 2021 The Matrix.org Foundation C.I.C. # Copyright (C) 2023 New Vector, Ltd # # This program is free software: you can redistribute it and/or modify diff --git a/tests/rest/client/test_shadow_banned.py b/tests/rest/client/test_shadow_banned.py
index 38eb2daf72..2287f233b4 100644 --- a/tests/rest/client/test_shadow_banned.py +++ b/tests/rest/client/test_shadow_banned.py
@@ -1,6 +1,7 @@ # # This file is licensed under the Affero General Public License (AGPL) version 3. # +# Copyright 2020 The Matrix.org Foundation C.I.C. # Copyright (C) 2023 New Vector, Ltd # # This program is free software: you can redistribute it and/or modify diff --git a/tests/rest/client/test_sync.py b/tests/rest/client/test_sync.py
index d52f1cc34e..417a87feb2 100644 --- a/tests/rest/client/test_sync.py +++ b/tests/rest/client/test_sync.py
@@ -1,6 +1,7 @@ # # This file is licensed under the Affero General Public License (AGPL) version 3. # +# Copyright 2019 The Matrix.org Foundation C.I.C. # Copyright (C) 2023 New Vector, Ltd # # This program is free software: you can redistribute it and/or modify diff --git a/tests/rest/client/test_third_party_rules.py b/tests/rest/client/test_third_party_rules.py
index 22b2e34570..d10df1a90f 100644 --- a/tests/rest/client/test_third_party_rules.py +++ b/tests/rest/client/test_third_party_rules.py
@@ -1,6 +1,7 @@ # # This file is licensed under the Affero General Public License (AGPL) version 3. # +# Copyright 2019 The Matrix.org Foundation C.I.C. # Copyright (C) 2023 New Vector, Ltd # # This program is free software: you can redistribute it and/or modify diff --git a/tests/rest/client/test_transactions.py b/tests/rest/client/test_transactions.py
index d7f479786d..af1eecbb34 100644 --- a/tests/rest/client/test_transactions.py +++ b/tests/rest/client/test_transactions.py
@@ -1,6 +1,7 @@ # # This file is licensed under the Affero General Public License (AGPL) version 3. # +# Copyright 2018-2021 The Matrix.org Foundation C.I.C. # Copyright (C) 2023 New Vector, Ltd # # This program is free software: you can redistribute it and/or modify diff --git a/tests/rest/client/test_typing.py b/tests/rest/client/test_typing.py
index 1a83e70f48..805c49b540 100644 --- a/tests/rest/client/test_typing.py +++ b/tests/rest/client/test_typing.py
@@ -1,6 +1,7 @@ # # This file is licensed under the Affero General Public License (AGPL) version 3. # +# Copyright 2014-2016 OpenMarket Ltd # Copyright (C) 2023 New Vector, Ltd # # This program is free software: you can redistribute it and/or modify diff --git a/tests/rest/client/test_upgrade_room.py b/tests/rest/client/test_upgrade_room.py
index 7038e42058..c4b15c5ae7 100644 --- a/tests/rest/client/test_upgrade_room.py +++ b/tests/rest/client/test_upgrade_room.py
@@ -1,6 +1,7 @@ # # This file is licensed under the Affero General Public License (AGPL) version 3. # +# Copyright 2021 The Matrix.org Foundation C.I.C. # Copyright (C) 2023 New Vector, Ltd # # This program is free software: you can redistribute it and/or modify diff --git a/tests/rest/client/utils.py b/tests/rest/client/utils.py
index 7bcbed246b..10cfe22d8e 100644 --- a/tests/rest/client/utils.py +++ b/tests/rest/client/utils.py
@@ -1,6 +1,9 @@ # # This file is licensed under the Affero General Public License (AGPL) version 3. # +# Copyright 2019-2021 The Matrix.org Foundation C.I.C. +# Copyright 2017 Vector Creations Ltd +# Copyright 2014-2016 OpenMarket Ltd # Copyright (C) 2023 New Vector, Ltd # # This program is free software: you can redistribute it and/or modify @@ -364,6 +367,7 @@ class RestHelper: tok: Optional[str] = None, expect_code: int = HTTPStatus.OK, custom_headers: Optional[Iterable[Tuple[AnyStr, AnyStr]]] = None, + type: str = "m.room.message", ) -> JsonDict: if body is None: body = "body_text_here" @@ -372,7 +376,7 @@ class RestHelper: return self.send_event( room_id, - "m.room.message", + type, content, txn_id, tok,