diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2019-03-04 10:05:39 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-04 10:05:39 +0000 |
commit | 2c3548d9d89ed4c8cefd5b18d1b86ff0fc2f52bf (patch) | |
tree | 4d49e024cbdc7affc544fc626589a2d1496420b8 /tests/utils.py | |
parent | Fix incorrect log about not persisting duplicate state event. (#4776) (diff) | |
download | synapse-2c3548d9d89ed4c8cefd5b18d1b86ff0fc2f52bf.tar.xz |
Update test_typing to use HomeserverTestCase. (#4771)
Diffstat (limited to '')
-rw-r--r-- | tests/utils.py | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/tests/utils.py b/tests/utils.py index cf49833a43..ee272157aa 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -29,7 +29,7 @@ from twisted.internet import defer, reactor from synapse.api.constants import EventTypes, RoomVersions from synapse.api.errors import CodeMessageException, cs_error from synapse.config.server import ServerConfig -from synapse.federation.transport import server +from synapse.federation.transport import server as federation_server from synapse.http.server import HttpServer from synapse.server import HomeServer from synapse.storage import DataStore @@ -200,6 +200,9 @@ def setup_test_homeserver( Args: cleanup_func : The function used to register a cleanup routine for after the test. + + Calling this method directly is deprecated: you should instead derive from + HomeserverTestCase. """ if reactor is None: from twisted.internet import reactor @@ -351,23 +354,27 @@ def setup_test_homeserver( fed = kargs.get("resource_for_federation", None) if fed: - server.register_servlets( - hs, - resource=fed, - authenticator=server.Authenticator(hs), - ratelimiter=FederationRateLimiter( - hs.get_clock(), - window_size=hs.config.federation_rc_window_size, - sleep_limit=hs.config.federation_rc_sleep_limit, - sleep_msec=hs.config.federation_rc_sleep_delay, - reject_limit=hs.config.federation_rc_reject_limit, - concurrent_requests=hs.config.federation_rc_concurrent, - ), - ) + register_federation_servlets(hs, fed) defer.returnValue(hs) +def register_federation_servlets(hs, resource): + federation_server.register_servlets( + hs, + resource=resource, + authenticator=federation_server.Authenticator(hs), + ratelimiter=FederationRateLimiter( + hs.get_clock(), + window_size=hs.config.federation_rc_window_size, + sleep_limit=hs.config.federation_rc_sleep_limit, + sleep_msec=hs.config.federation_rc_sleep_delay, + reject_limit=hs.config.federation_rc_reject_limit, + concurrent_requests=hs.config.federation_rc_concurrent, + ), + ) + + def get_mock_call_args(pattern_func, mock_func): """ Return the arguments the mock function was called with interpreted by the pattern functions argument list. |