diff options
author | Brendan Abolivier <babolivier@matrix.org> | 2022-11-03 16:21:31 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-03 16:21:31 +0000 |
commit | 86c5a710d8b4212f8a8a668d7d4a79c0bb371508 (patch) | |
tree | cfa397b2ba6170a67ad1a6a33fa302846fc05bf3 /tests/rest/client/utils.py | |
parent | Use maintained action to install Rust in latest deps/twisted trunk jobs (#14351) (diff) | |
download | synapse-86c5a710d8b4212f8a8a668d7d4a79c0bb371508.tar.xz |
Implement MSC3912: Relation-based redactions (#14260)
Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com>
Diffstat (limited to 'tests/rest/client/utils.py')
-rw-r--r-- | tests/rest/client/utils.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/rest/client/utils.py b/tests/rest/client/utils.py index 706399fae5..8d6f2b6ff9 100644 --- a/tests/rest/client/utils.py +++ b/tests/rest/client/utils.py @@ -410,6 +410,43 @@ class RestHelper: return channel.json_body + def get_event( + self, + room_id: str, + event_id: str, + tok: Optional[str] = None, + expect_code: int = HTTPStatus.OK, + ) -> JsonDict: + """Request a specific event from the server. + + Args: + room_id: the room in which the event was sent. + event_id: the event's ID. + tok: the token to request the event with. + expect_code: the expected HTTP status for the response. + + Returns: + The event as a dict. + """ + path = f"/_matrix/client/v3/rooms/{room_id}/event/{event_id}" + if tok: + path = path + f"?access_token={tok}" + + channel = make_request( + self.hs.get_reactor(), + self.site, + "GET", + path, + ) + + assert channel.code == expect_code, "Expected: %d, got: %d, resp: %r" % ( + expect_code, + channel.code, + channel.result["body"], + ) + + return channel.json_body + def _read_write_state( self, room_id: str, |