summary refs log tree commit diff
path: root/tests/utils.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-01-26 13:52:29 +0000
committerErik Johnston <erik@matrix.org>2016-01-26 13:52:29 +0000
commit9959d9ece84d85dae3ed06b22e3f234575b93fd1 (patch)
treee5d4fd2289abdac72f2a7bf9f0a0dda2e0bb72f5 /tests/utils.py
parentMerge pull request #524 from matrix-org/erikj/sync (diff)
downloadsynapse-9959d9ece84d85dae3ed06b22e3f234575b93fd1.tar.xz
Remove redundated BaseHomeServer
Diffstat (limited to 'tests/utils.py')
-rw-r--r--tests/utils.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/utils.py b/tests/utils.py
index 358b5b72b7..d75d492cb5 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -19,6 +19,8 @@ from synapse.api.constants import EventTypes
 from synapse.storage.prepare_database import prepare_database
 from synapse.storage.engines import create_engine
 from synapse.server import HomeServer
+from synapse.federation.transport import server
+from synapse.util.ratelimitutils import FederationRateLimiter
 
 from synapse.util.logcontext import LoggingContext
 
@@ -80,6 +82,22 @@ def setup_test_homeserver(name="test", datastore=None, config=None, **kargs):
 
     hs.build_handlers = swap_out_hash_for_testing(hs.build_handlers)
 
+    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
+            ),
+        )
+
     defer.returnValue(hs)