summary refs log tree commit diff
path: root/tests/unittest.py
diff options
context:
space:
mode:
authorAmber Brown <hawkowl@atleastfornow.net>2019-03-22 02:10:21 +1100
committerGitHub <noreply@github.com>2019-03-22 02:10:21 +1100
commita68e00fca8ee4d9f52f19a07e2d082787f4beb8e (patch)
tree52711495aa109e49b25e7df1ec6d82ec7ba753b6 /tests/unittest.py
parentRemove trailing slashes from outbound federation requests and retry on 400 (#... (diff)
downloadsynapse-a68e00fca8ee4d9f52f19a07e2d082787f4beb8e.tar.xz
Some more porting to HomeserverTestCase and remove old RESTHelper (#4913)
Diffstat (limited to '')
-rw-r--r--tests/unittest.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/unittest.py b/tests/unittest.py
index 7772a47078..27403de908 100644
--- a/tests/unittest.py
+++ b/tests/unittest.py
@@ -314,6 +314,9 @@ class HomeserverTestCase(TestCase):
         """
         kwargs = dict(kwargs)
         kwargs.update(self._hs_args)
+        if "config" not in kwargs:
+            config = self.default_config()
+            kwargs["config"] = config
         hs = setup_test_homeserver(self.addCleanup, *args, **kwargs)
         stor = hs.get_datastore()
 
@@ -336,6 +339,15 @@ class HomeserverTestCase(TestCase):
         self.pump(by=by)
         return self.successResultOf(d)
 
+    def get_failure(self, d, exc):
+        """
+        Run a Deferred and get a Failure from it. The failure must be of the type `exc`.
+        """
+        if not isinstance(d, Deferred):
+            return d
+        self.pump()
+        return self.failureResultOf(d, exc)
+
     def register_user(self, username, password, admin=False):
         """
         Register a user. Requires the Admin API be registered.