summary refs log tree commit diff
path: root/tests/rest/client/utils.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@element.io>2024-08-19 21:16:07 +0100
committerGitHub <noreply@github.com>2024-08-19 21:16:07 +0100
commit8b8d74d12f29a9b58c367715d7b8234e39a5eb1a (patch)
tree267b695c5e4b09c9263b24731c3f62803207bdff /tests/rest/client/utils.py
parentSliding sync: Add classes for per-connection state (#17574) (diff)
downloadsynapse-8b8d74d12f29a9b58c367715d7b8234e39a5eb1a.tar.xz
Sliding sync: Correctly track which read receipts we have or have not sent down. (#17575)
Add connection tracking to the receipts extension.

Based on #17574

---------

Co-authored-by: Eric Eastwood <eric.eastwood@beta.gouv.fr>
Diffstat (limited to '')
-rw-r--r--tests/rest/client/utils.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/rest/client/utils.py b/tests/rest/client/utils.py

index e43140720d..9614cdd66a 100644 --- a/tests/rest/client/utils.py +++ b/tests/rest/client/utils.py
@@ -45,7 +45,7 @@ from typing_extensions import Literal from twisted.test.proto_helpers import MemoryReactorClock from twisted.web.server import Site -from synapse.api.constants import Membership +from synapse.api.constants import Membership, ReceiptTypes from synapse.api.errors import Codes from synapse.server import HomeServer from synapse.types import JsonDict @@ -944,3 +944,15 @@ class RestHelper: assert len(p.links) == 1, "not exactly one link in confirmation page" oauth_uri = p.links[0] return oauth_uri + + def send_read_receipt(self, room_id: str, event_id: str, *, tok: str) -> None: + """Send a read receipt into the room at the given event""" + channel = make_request( + self.reactor, + self.site, + method="POST", + path=f"/rooms/{room_id}/receipt/{ReceiptTypes.READ}/{event_id}", + content={}, + access_token=tok, + ) + assert channel.code == HTTPStatus.OK, channel.text_body