summary refs log tree commit diff
path: root/tests/server.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/server.py')
-rw-r--r--tests/server.py22
1 files changed, 17 insertions, 5 deletions
diff --git a/tests/server.py b/tests/server.py
index 73069dff52..c611dd6059 100644
--- a/tests/server.py
+++ b/tests/server.py
@@ -1,15 +1,17 @@
+import json
 from io import BytesIO
 
-import attr
-import json
 from six import text_type
 
-from twisted.python.failure import Failure
+import attr
+
+from twisted.internet import threads
 from twisted.internet.defer import Deferred
+from twisted.python.failure import Failure
 from twisted.test.proto_helpers import MemoryReactorClock
 
 from synapse.http.site import SynapseRequest
-from twisted.internet import threads
+
 from tests.utils import setup_test_homeserver as _sth
 
 
@@ -20,7 +22,7 @@ class FakeChannel(object):
     wire).
     """
 
-    result = attr.ib(factory=dict)
+    result = attr.ib(default=attr.Factory(dict))
 
     @property
     def json_body(self):
@@ -78,6 +80,11 @@ def make_request(method, path, content=b""):
     content, and return the Request and the Channel underneath.
     """
 
+    # Decorate it to be the full path
+    if not path.startswith(b"/_matrix"):
+        path = b"/_matrix/client/r0/" + path
+        path = path.replace("//", "/")
+
     if isinstance(content, text_type):
         content = content.encode('utf8')
 
@@ -108,6 +115,11 @@ def wait_until_result(clock, channel, timeout=100):
         clock.advance(0.1)
 
 
+def render(request, resource, clock):
+    request.render(resource)
+    wait_until_result(clock, request._channel)
+
+
 class ThreadedMemoryReactorClock(MemoryReactorClock):
     """
     A MemoryReactorClock that supports callFromThread.