mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 22:14:55 -04:00
Refactor REST API tests to use explicit reactors (#3351)
This commit is contained in:
parent
c7320a5564
commit
bc006b3c9d
13 changed files with 985 additions and 980 deletions
|
@ -80,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')
|
||||
|
||||
|
@ -110,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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue