summary refs log tree commit diff
path: root/tests/rest/client/v1
diff options
context:
space:
mode:
authorBrendan Abolivier <babolivier@matrix.org>2020-07-29 18:26:55 +0100
committerGitHub <noreply@github.com>2020-07-29 18:26:55 +0100
commit8dff4a12424cda9e4abaa5f2905d58aa6e723777 (patch)
treeed7a3fde822301d9cd82ce22eb56e53ae40b5c32 /tests/rest/client/v1
parentVarious improvements to the docs (#7899) (diff)
downloadsynapse-8dff4a12424cda9e4abaa5f2905d58aa6e723777.tar.xz
Re-implement unread counts (#7736)
Diffstat (limited to 'tests/rest/client/v1')
-rw-r--r--tests/rest/client/v1/utils.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/rest/client/v1/utils.py b/tests/rest/client/v1/utils.py
index 22d734e763..7f8252330a 100644
--- a/tests/rest/client/v1/utils.py
+++ b/tests/rest/client/v1/utils.py
@@ -143,6 +143,26 @@ class RestHelper(object):
 
         return channel.json_body
 
+    def redact(self, room_id, event_id, txn_id=None, tok=None, expect_code=200):
+        if txn_id is None:
+            txn_id = "m%s" % (str(time.time()))
+
+        path = "/_matrix/client/r0/rooms/%s/redact/%s/%s" % (room_id, event_id, txn_id)
+        if tok:
+            path = path + "?access_token=%s" % tok
+
+        request, channel = make_request(
+            self.hs.get_reactor(), "PUT", path, json.dumps({}).encode("utf8")
+        )
+        render(request, self.resource, self.hs.get_reactor())
+
+        assert int(channel.result["code"]) == expect_code, (
+            "Expected: %d, got: %d, resp: %r"
+            % (expect_code, int(channel.result["code"]), channel.result["body"])
+        )
+
+        return channel.json_body
+
     def _read_write_state(
         self,
         room_id: str,