summary refs log tree commit diff
path: root/tests/unittest.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2018-08-20 11:12:18 +0100
committerErik Johnston <erik@matrix.org>2018-08-20 11:12:18 +0100
commitf5abc10724c1e7ebc12102109c937c3060d58aaa (patch)
treee7a9c29027dbecea08c100912c7d798be35b41df /tests/unittest.py
parentMerge branch 'develop' of github.com:matrix-org/synapse into matrix-org-hotfixes (diff)
parentMerge pull request #3713 from matrix-org/erikj/fixup_fed_logging (diff)
downloadsynapse-f5abc10724c1e7ebc12102109c937c3060d58aaa.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into matrix-org-hotfixes
Diffstat (limited to 'tests/unittest.py')
-rw-r--r--tests/unittest.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/unittest.py b/tests/unittest.py

index e6afe3b96d..d852e2465a 100644 --- a/tests/unittest.py +++ b/tests/unittest.py
@@ -18,6 +18,8 @@ import logging from mock import Mock +from canonicaljson import json + import twisted import twisted.logger from twisted.trial import unittest @@ -241,11 +243,15 @@ class HomeserverTestCase(TestCase): method (bytes/unicode): The HTTP request method ("verb"). path (bytes/unicode): The HTTP path, suitably URL encoded (e.g. escaped UTF-8 & spaces and such). - content (bytes): The body of the request. + content (bytes or dict): The body of the request. JSON-encoded, if + a dict. Returns: A synapse.http.site.SynapseRequest. """ + if isinstance(content, dict): + content = json.dumps(content).encode('utf8') + return make_request(method, path, content) def render(self, request):