mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 11:26:09 -04:00
Add reactor to SynapseRequest
and fix up types. (#10868)
This commit is contained in:
parent
fa74536384
commit
50022cff96
24 changed files with 123 additions and 82 deletions
|
@ -19,6 +19,7 @@ from twisted.internet.interfaces import (
|
|||
IPullProducer,
|
||||
IPushProducer,
|
||||
IReactorPluggableNameResolver,
|
||||
IReactorTime,
|
||||
IResolverSimple,
|
||||
ITransport,
|
||||
)
|
||||
|
@ -181,13 +182,14 @@ class FakeSite:
|
|||
site_tag = "test"
|
||||
access_logger = logging.getLogger("synapse.access.http.fake")
|
||||
|
||||
def __init__(self, resource: IResource):
|
||||
def __init__(self, resource: IResource, reactor: IReactorTime):
|
||||
"""
|
||||
|
||||
Args:
|
||||
resource: the resource to be used for rendering all requests
|
||||
"""
|
||||
self._resource = resource
|
||||
self.reactor = reactor
|
||||
|
||||
def getResourceFor(self, request):
|
||||
return self._resource
|
||||
|
@ -268,7 +270,7 @@ def make_request(
|
|||
|
||||
channel = FakeChannel(site, reactor, ip=client_ip)
|
||||
|
||||
req = request(channel)
|
||||
req = request(channel, site)
|
||||
req.content = BytesIO(content)
|
||||
# Twisted expects to be at the end of the content when parsing the request.
|
||||
req.content.seek(SEEK_END)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue