summary refs log tree commit diff
path: root/tests/handlers/test_presencelike.py
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-02-11 11:37:30 +0000
committerMark Haines <mark.haines@matrix.org>2015-02-11 11:37:30 +0000
commit896253e085751df88e747b29e638916b15cf7a0e (patch)
treeea62bdb8650946adfa6c9dc4603ce87a39e55e3e /tests/handlers/test_presencelike.py
parentMerge pull request #60 from matrix-org/single_source_version_and_dependencies (diff)
downloadsynapse-896253e085751df88e747b29e638916b15cf7a0e.tar.xz
Factor out some of the common homeserver setup code into a
setup_test_homeserver function in utils.
Diffstat (limited to 'tests/handlers/test_presencelike.py')
-rw-r--r--tests/handlers/test_presencelike.py39
1 files changed, 16 insertions, 23 deletions
diff --git a/tests/handlers/test_presencelike.py b/tests/handlers/test_presencelike.py
index 3cdbb186ae..18cac9a846 100644
--- a/tests/handlers/test_presencelike.py
+++ b/tests/handlers/test_presencelike.py
@@ -21,9 +21,8 @@ from twisted.internet import defer
 
 from mock import Mock, call, ANY, NonCallableMock
 
-from ..utils import MockClock, MockKey
+from ..utils import MockClock, setup_test_homeserver
 
-from synapse.server import HomeServer
 from synapse.api.constants import PresenceState
 from synapse.handlers.presence import PresenceHandler
 from synapse.handlers.profile import ProfileHandler
@@ -57,29 +56,23 @@ class PresenceAndProfileHandlers(object):
 
 class PresenceProfilelikeDataTestCase(unittest.TestCase):
 
+    @defer.inlineCallbacks
     def setUp(self):
-        self.mock_config = Mock()
-        self.mock_config.signing_key = [MockKey()]
-
-        hs = HomeServer("test",
-                clock=MockClock(),
-                db_pool=None,
-                datastore=Mock(spec=[
-                    "set_presence_state",
-                    "is_presence_visible",
-
-                    "set_profile_displayname",
-
-                    "get_rooms_for_user_where_membership_is",
-                ]),
-                handlers=None,
-                resource_for_federation=Mock(),
-                http_client=None,
-                replication_layer=MockReplication(),
-                ratelimiter=NonCallableMock(spec_set=[
+        hs = yield setup_test_homeserver(
+            clock=MockClock(),
+            datastore=Mock(spec=[
+                "set_presence_state",
+                "is_presence_visible",
+                "set_profile_displayname",
+                "get_rooms_for_user_where_membership_is",
+            ]),
+            handlers=None,
+            resource_for_federation=Mock(),
+            http_client=None,
+            replication_layer=MockReplication(),
+            ratelimiter=NonCallableMock(spec_set=[
                 "send_message",
-                ]),
-                config=self.mock_config
+            ]),
         )
         self.ratelimiter = hs.get_ratelimiter()
         self.ratelimiter.send_message.return_value = (True, 0)