summary refs log tree commit diff
path: root/tests/rest
diff options
context:
space:
mode:
authorAmber Brown <hawkowl@atleastfornow.net>2018-08-31 00:19:58 +1000
committerGitHub <noreply@github.com>2018-08-31 00:19:58 +1000
commit14e4d4f4bf894f4e70118e03f4f4575e1eb6dab6 (patch)
tree1c7ba21ab2ebe5dbf4c7c15b0b89376fda865c31 /tests/rest
parentMerge pull request #3764 from matrix-org/rav/close_db_conn_after_init (diff)
downloadsynapse-14e4d4f4bf894f4e70118e03f4f4575e1eb6dab6.tar.xz
Port storage/ to Python 3 (#3725)
Diffstat (limited to 'tests/rest')
-rw-r--r--tests/rest/client/v1/utils.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/tests/rest/client/v1/utils.py b/tests/rest/client/v1/utils.py
index 40dc4ea256..530dc8ba6d 100644
--- a/tests/rest/client/v1/utils.py
+++ b/tests/rest/client/v1/utils.py
@@ -240,7 +240,6 @@ class RestHelper(object):
         self.assertEquals(200, code)
         defer.returnValue(response)
 
-    @defer.inlineCallbacks
     def send(self, room_id, body=None, txn_id=None, tok=None, expect_code=200):
         if txn_id is None:
             txn_id = "m%s" % (str(time.time()))
@@ -248,9 +247,16 @@ class RestHelper(object):
             body = "body_text_here"
 
         path = "/_matrix/client/r0/rooms/%s/send/m.room.message/%s" % (room_id, txn_id)
-        content = '{"msgtype":"m.text","body":"%s"}' % body
+        content = {"msgtype": "m.text", "body": body}
         if tok:
             path = path + "?access_token=%s" % tok
 
-        (code, response) = yield self.mock_resource.trigger("PUT", path, content)
-        self.assertEquals(expect_code, code, msg=str(response))
+        request, channel = make_request("PUT", path, json.dumps(content).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