summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Wagner-Hall <dawagner@gmail.com>2015-08-28 15:42:25 +0100
committerDaniel Wagner-Hall <dawagner@gmail.com>2015-08-28 15:42:25 +0100
commitb143641b2060ec031a8a11959a669345cd16c394 (patch)
tree842687eeead33ab1a11b429864bcac8ce7029c61 /tests
parentMerge branch 'release-v0.10.0' into develop (diff)
parentRemove unused import (diff)
downloadsynapse-b143641b2060ec031a8a11959a669345cd16c394.tar.xz
Merge pull request #258 from matrix-org/slowtestsmakemesad
Swap out bcrypt for md5 in tests
Diffstat (limited to 'tests')
-rw-r--r--tests/utils.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/utils.py b/tests/utils.py

index 3766a994f2..dd19a16fc7 100644 --- a/tests/utils.py +++ b/tests/utils.py
@@ -27,6 +27,7 @@ from twisted.enterprise.adbapi import ConnectionPool from collections import namedtuple from mock import patch, Mock +import hashlib import urllib import urlparse @@ -67,6 +68,18 @@ def setup_test_homeserver(name="test", datastore=None, config=None, **kargs): **kargs ) + # bcrypt is far too slow to be doing in unit tests + def swap_out_hash_for_testing(old_build_handlers): + def build_handlers(): + handlers = old_build_handlers() + auth_handler = handlers.auth_handler + auth_handler.hash = lambda p: hashlib.md5(p).hexdigest() + auth_handler.validate_hash = lambda p, h: hashlib.md5(p).hexdigest() == h + return handlers + return build_handlers + + hs.build_handlers = swap_out_hash_for_testing(hs.build_handlers) + defer.returnValue(hs)