summary refs log tree commit diff
path: root/tests/rest
diff options
context:
space:
mode:
authorAmber Brown <hawkowl@atleastfornow.net>2019-05-21 11:36:50 -0500
committerGitHub <noreply@github.com>2019-05-21 11:36:50 -0500
commit4a30e4acb4ef14431914bd42ad09a51bd81d6c3e (patch)
tree7857cc1ab121d9255183b51be0e79d8619cc3c8f /tests/rest
parentMerge pull request #5203 from matrix-org/erikj/aggregate_by_sender (diff)
downloadsynapse-4a30e4acb4ef14431914bd42ad09a51bd81d6c3e.tar.xz
Room Statistics (#4338)
Diffstat (limited to 'tests/rest')
-rw-r--r--tests/rest/client/v1/utils.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/rest/client/v1/utils.py b/tests/rest/client/v1/utils.py
index 05b0143c42..f7133fc12e 100644
--- a/tests/rest/client/v1/utils.py
+++ b/tests/rest/client/v1/utils.py
@@ -127,3 +127,20 @@ class RestHelper(object):
         )
 
         return channel.json_body
+
+    def send_state(self, room_id, event_type, body, tok, expect_code=200):
+        path = "/_matrix/client/r0/rooms/%s/state/%s" % (room_id, event_type)
+        if tok:
+            path = path + "?access_token=%s" % tok
+
+        request, channel = make_request(
+            self.hs.get_reactor(), "PUT", path, json.dumps(body).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