summary refs log tree commit diff
path: root/tests/utils.py
diff options
context:
space:
mode:
authorAmber Brown <hawkowl@atleastfornow.net>2018-08-09 12:22:01 +1000
committerGitHub <noreply@github.com>2018-08-09 12:22:01 +1000
commit2511f3f8a082585e680dad200069dec77b066a6a (patch)
tree90212ffc4a723c50a537a3b1865d6468bebf431b /tests/utils.py
parentMerge pull request #3664 from matrix-org/rav/federation_metrics (diff)
downloadsynapse-2511f3f8a082585e680dad200069dec77b066a6a.tar.xz
Test fixes for Python 3 (#3647)
Diffstat (limited to 'tests/utils.py')
-rw-r--r--tests/utils.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/utils.py b/tests/utils.py
index 151db4b890..5d49692c58 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -153,8 +153,9 @@ def setup_test_homeserver(name="test", datastore=None, config=None, reactor=None
     # Need to let the HS build an auth handler and then mess with it
     # because AuthHandler's constructor requires the HS, so we can't make one
     # beforehand and pass it in to the HS's constructor (chicken / egg)
-    hs.get_auth_handler().hash = lambda p: hashlib.md5(p).hexdigest()
-    hs.get_auth_handler().validate_hash = lambda p, h: hashlib.md5(p).hexdigest() == h
+    hs.get_auth_handler().hash = lambda p: hashlib.md5(p.encode('utf8')).hexdigest()
+    hs.get_auth_handler().validate_hash = lambda p, h: hashlib.md5(
+        p.encode('utf8')).hexdigest() == h
 
     fed = kargs.get("resource_for_federation", None)
     if fed:
@@ -227,8 +228,8 @@ class MockHttpResource(HttpServer):
         mock_content.configure_mock(**config)
         mock_request.content = mock_content
 
-        mock_request.method = http_method
-        mock_request.uri = path
+        mock_request.method = http_method.encode('ascii')
+        mock_request.uri = path.encode('ascii')
 
         mock_request.getClientIP.return_value = "-"