summary refs log tree commit diff
path: root/tests/unittest.py
diff options
context:
space:
mode:
authorAmber Brown <hawkowl@atleastfornow.net>2018-11-07 03:00:00 +1100
committerGitHub <noreply@github.com>2018-11-07 03:00:00 +1100
commite62f7f17b32fa51a818fdcfc756464692ddb9194 (patch)
treed34e06c6c32e0637bea8aa66bf516d419dce26b2 /tests/unittest.py
parentAdd config variables for enabling terms auth and the policy name (#4142) (diff)
downloadsynapse-e62f7f17b32fa51a818fdcfc756464692ddb9194.tar.xz
Remove some boilerplate in tests (#4156)
Diffstat (limited to 'tests/unittest.py')
-rw-r--r--tests/unittest.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/unittest.py b/tests/unittest.py
index 5e35c943d7..a9ce57da9a 100644
--- a/tests/unittest.py
+++ b/tests/unittest.py
@@ -189,11 +189,11 @@ class HomeserverTestCase(TestCase):
         for servlet in self.servlets:
             servlet(self.hs, self.resource)
 
-        if hasattr(self, "user_id"):
-            from tests.rest.client.v1.utils import RestHelper
+        from tests.rest.client.v1.utils import RestHelper
 
-            self.helper = RestHelper(self.hs, self.resource, self.user_id)
+        self.helper = RestHelper(self.hs, self.resource, getattr(self, "user_id", None))
 
+        if hasattr(self, "user_id"):
             if self.hijack_auth:
 
                 def get_user_by_access_token(token=None, allow_guest=False):
@@ -285,7 +285,9 @@ class HomeserverTestCase(TestCase):
         if isinstance(content, dict):
             content = json.dumps(content).encode('utf8')
 
-        return make_request(method, path, content, access_token, request, shorthand)
+        return make_request(
+            self.reactor, method, path, content, access_token, request, shorthand
+        )
 
     def render(self, request):
         """