diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2020-11-16 14:45:22 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-16 14:45:22 +0000 |
commit | ebc405446e6615d6187a2e29cb33f27dd5bd0841 (patch) | |
tree | 5903e9c8a8776146e604e99ee2d54119c7974999 /tests/storage/test_client_ips.py | |
parent | Clarify the usecase for an msisdn delegate (#8734) (diff) | |
download | synapse-ebc405446e6615d6187a2e29cb33f27dd5bd0841.tar.xz |
Add a `custom_headers` param to `make_request` (#8760)
Some tests want to set some custom HTTP request headers, so provide a way to do that before calling requestReceived().
Diffstat (limited to 'tests/storage/test_client_ips.py')
-rw-r--r-- | tests/storage/test_client_ips.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/storage/test_client_ips.py b/tests/storage/test_client_ips.py index e96ca1c8ca..efca43ec78 100644 --- a/tests/storage/test_client_ips.py +++ b/tests/storage/test_client_ips.py @@ -21,6 +21,7 @@ from synapse.http.site import XForwardedForRequest from synapse.rest.client.v1 import login from tests import unittest +from tests.server import make_request from tests.test_utils import make_awaitable from tests.unittest import override_config @@ -408,17 +409,17 @@ class ClientIpAuthTestCase(unittest.HomeserverTestCase): # Advance to a known time self.reactor.advance(123456 - self.reactor.seconds()) - request, channel = self.make_request( + headers1 = {b"User-Agent": b"Mozzila pizza"} + headers1.update(headers) + + request, channel = make_request( + self.reactor, "GET", "/_matrix/client/r0/admin/users/" + self.user_id, access_token=access_token, + custom_headers=headers1.items(), **make_request_args, ) - request.requestHeaders.addRawHeader(b"User-Agent", b"Mozzila pizza") - - # Add the optional headers - for h, v in headers.items(): - request.requestHeaders.addRawHeader(h, v) self.render(request) # Advance so the save loop occurs |