summary refs log tree commit diff
path: root/tests/utils.py
diff options
context:
space:
mode:
authorWill Hunt <will@half-shot.uk>2018-07-09 13:31:21 +0000
committerGitHub <noreply@github.com>2018-07-09 13:31:21 +0000
commita7f4ebbd3e786ce2e156127a3806aa2594233542 (patch)
treec73795182b60fcc17a5e5b13864eb84758d96c29 /tests/utils.py
parent/limits => /config (diff)
parentMerge pull request #3464 from matrix-org/hawkowl/isort-run (diff)
downloadsynapse-a7f4ebbd3e786ce2e156127a3806aa2594233542.tar.xz
Merge branch 'develop' into hs/upload-limits
Diffstat (limited to 'tests/utils.py')
-rw-r--r--tests/utils.py15
1 files changed, 11 insertions, 4 deletions
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() ]