summary refs log tree commit diff
path: root/tests/rest/client
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2022-05-16 08:42:45 -0400
committerGitHub <noreply@github.com>2022-05-16 12:42:45 +0000
commit86a515ccbf359ecd65a42a3f409b8f97c8f22284 (patch)
tree0f1b02378c8baa282444026399a3abc42e7a3fb3 /tests/rest/client
parentAdd config flags to allow for cache auto-tuning (#12701) (diff)
downloadsynapse-86a515ccbf359ecd65a42a3f409b8f97c8f22284.tar.xz
Consolidate logic for parsing relations. (#12693)
Parse the `m.relates_to` event content field (which describes relations)
in a single place, this is used during:

* Event persistence.
* Validation of the Client-Server API.
* Fetching bundled aggregations.
* Processing of push rules.

Each of these separately implement the logic and each made slightly
different assumptions about what was valid. Some had minor / potential
bugs.
Diffstat (limited to 'tests/rest/client')
-rw-r--r--tests/rest/client/test_sync.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/rest/client/test_sync.py b/tests/rest/client/test_sync.py
index 2722bf26e7..74b6560cbc 100644
--- a/tests/rest/client/test_sync.py
+++ b/tests/rest/client/test_sync.py
@@ -656,12 +656,13 @@ class UnreadMessagesTestCase(unittest.HomeserverTestCase):
         self._check_unread_count(3)
 
         # Check that custom events with a body increase the unread counter.
-        self.helper.send_event(
+        result = self.helper.send_event(
             self.room_id,
             "org.matrix.custom_type",
             {"body": "hello"},
             tok=self.tok2,
         )
+        event_id = result["event_id"]
         self._check_unread_count(4)
 
         # Check that edits don't increase the unread counter.
@@ -671,7 +672,10 @@ class UnreadMessagesTestCase(unittest.HomeserverTestCase):
             content={
                 "body": "hello",
                 "msgtype": "m.text",
-                "m.relates_to": {"rel_type": RelationTypes.REPLACE},
+                "m.relates_to": {
+                    "rel_type": RelationTypes.REPLACE,
+                    "event_id": event_id,
+                },
             },
             tok=self.tok2,
         )