mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 22:14:55 -04:00
Merge branch 'master' into develop
This commit is contained in:
commit
4f8baab0c4
9 changed files with 157 additions and 47 deletions
|
@ -321,7 +321,10 @@ class MockHttpResource(HttpServer):
|
|||
|
||||
@patch('twisted.web.http.Request')
|
||||
@defer.inlineCallbacks
|
||||
def trigger(self, http_method, path, content, mock_request, federation_auth=False):
|
||||
def trigger(
|
||||
self, http_method, path, content, mock_request,
|
||||
federation_auth_origin=None,
|
||||
):
|
||||
""" Fire an HTTP event.
|
||||
|
||||
Args:
|
||||
|
@ -330,6 +333,7 @@ class MockHttpResource(HttpServer):
|
|||
content : The HTTP body
|
||||
mock_request : Mocked request to pass to the event so it can get
|
||||
content.
|
||||
federation_auth_origin (bytes|None): domain to authenticate as, for federation
|
||||
Returns:
|
||||
A tuple of (code, response)
|
||||
Raises:
|
||||
|
@ -350,8 +354,10 @@ class MockHttpResource(HttpServer):
|
|||
mock_request.getClientIP.return_value = "-"
|
||||
|
||||
headers = {}
|
||||
if federation_auth:
|
||||
headers[b"Authorization"] = [b"X-Matrix origin=test,key=,sig="]
|
||||
if federation_auth_origin is not None:
|
||||
headers[b"Authorization"] = [
|
||||
b"X-Matrix origin=%s,key=,sig=" % (federation_auth_origin, )
|
||||
]
|
||||
mock_request.requestHeaders.getRawHeaders = mock_getRawHeaders(headers)
|
||||
|
||||
# return the right path if the event requires it
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue