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-05 15:21:36 +0100
committerRichard van der Hoff <richard@matrix.org>2018-09-05 15:21:36 +0100
commit86157b9743c5bf7ab3c23812efde70a7124572eb (patch)
treef045f4cdb49eed796108fbb78bce638842225c8d /tests/utils.py
parentMerge branch 'develop' of github.com:matrix-org/synapse into matrix-org-hotfixes (diff)
parentFix origin handling for pushed transactions (diff)
downloadsynapse-86157b9743c5bf7ab3c23812efde70a7124572eb.tar.xz
Merge branch 'rav/fix_event_sig_checks' into matrix-org/fix_event_sig_checks github/matrix-org/fix_event_sig_checks matrix-org/fix_event_sig_checks
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 9f7ff94575..036f628e65 100644 --- a/tests/utils.py +++ b/tests/utils.py
@@ -307,7 +307,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: @@ -316,6 +319,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: @@ -336,8 +340,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