summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2015-02-05 17:04:59 +0000
committerKegan Dougal <kegan@matrix.org>2015-02-05 17:04:59 +0000
commit11e6b3d18b5ae95857e01884960a01b9ea4d307d (patch)
tree34b03e7fd032f8cb6514fc2c014d4582b9ebd9d4 /tests
parentAdd delta sql file. (diff)
downloadsynapse-11e6b3d18b5ae95857e01884960a01b9ea4d307d.tar.xz
Dependency inject ApplicationServiceApi when creating ApplicationServicesHandler.
Diffstat (limited to 'tests')
-rw-r--r--tests/handlers/test_appservice.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/tests/handlers/test_appservice.py b/tests/handlers/test_appservice.py
index e16e511587..a2c541317c 100644
--- a/tests/handlers/test_appservice.py
+++ b/tests/handlers/test_appservice.py
@@ -29,13 +29,9 @@ class AppServiceHandlerTestCase(unittest.TestCase):
         self.mock_as_api = Mock()
         hs = Mock()
         hs.get_datastore = Mock(return_value=self.mock_store)
-        self.handler = ApplicationServicesHandler(hs)  # thing being tested
-
-        # FIXME Would be nice to DI this rather than monkey patch:(
-        if not hasattr(self.handler, "appservice_api"):
-            # someone probably updated the handler but not the tests. Fail fast.
-            raise Exception("Test expected handler.appservice_api to exist.")
-        self.handler.appservice_api = self.mock_as_api
+        self.handler = ApplicationServicesHandler(
+            hs, self.mock_as_api
+        )
 
     @defer.inlineCallbacks
     def test_notify_interested_services(self):