diff --git a/tests/utils.py b/tests/utils.py
index 0cd9f7eeee..6adbdbfca1 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -15,10 +15,10 @@
import hashlib
from inspect import getcallargs
-import urllib
-import urlparse
from mock import Mock, patch
+from six.moves.urllib import parse as urlparse
+
from twisted.internet import defer, reactor
from synapse.api.errors import CodeMessageException, cs_error
@@ -38,11 +38,15 @@ USE_POSTGRES_FOR_TESTS = False
@defer.inlineCallbacks
-def setup_test_homeserver(name="test", datastore=None, config=None, **kargs):
+def setup_test_homeserver(name="test", datastore=None, config=None, reactor=None,
+ **kargs):
"""Setup a homeserver suitable for running tests against. Keyword arguments
are passed to the Homeserver constructor. If no datastore is supplied a
datastore backed by an in-memory sqlite db will be given to the HS.
"""
+ if reactor is None:
+ from twisted.internet import reactor
+
if config is None:
config = Mock()
config.signing_key = [MockKey()]
@@ -64,6 +68,8 @@ def setup_test_homeserver(name="test", datastore=None, config=None, **kargs):
config.federation_rc_concurrent = 10
config.filter_timeline_limit = 5000
config.user_directory_search_all_users = False
+ config.user_consent_server_notice_content = None
+ config.block_events_without_consent_error = None
# disable user directory updates, because they get done in the
# background, which upsets the test runner.
@@ -109,6 +115,7 @@ def setup_test_homeserver(name="test", datastore=None, config=None, **kargs):
database_engine=db_engine,
room_list_handler=object(),
tls_server_context_factory=Mock(),
+ reactor=reactor,
**kargs
)
db_conn = hs.get_db_conn()
@@ -238,7 +245,7 @@ class MockHttpResource(HttpServer):
if matcher:
try:
args = [
- urllib.unquote(u).decode("UTF-8")
+ urlparse.unquote(u).decode("UTF-8")
for u in matcher.groups()
]
|