summary refs log tree commit diff
path: root/tests/utils.py
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2018-09-04 01:23:18 +0100
committerRichard van der Hoff <richard@matrix.org>2018-09-05 17:06:57 +0100
commita5a0bf5cf71caed3c4e3677d2bce667c147dadfc (patch)
tree4e55cdc564c506224bebc52c81daadfbabc303e6 /tests/utils.py
parentCheck that signatures on events are valid (diff)
downloadsynapse-a5a0bf5cf71caed3c4e3677d2bce667c147dadfc.tar.xz
Fix origin handling for pushed transactions
Use the actual origin for push transactions, rather than whatever the remote
server claimed.
Diffstat (limited to 'tests/utils.py')
-rw-r--r--tests/utils.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/utils.py b/tests/utils.py

index 9bff3ff3b9..63730e7f29 100644 --- a/tests/utils.py +++ b/tests/utils.py
@@ -197,7 +197,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: @@ -206,6 +209,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: @@ -226,8 +230,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