From 896253e085751df88e747b29e638916b15cf7a0e Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Wed, 11 Feb 2015 11:37:30 +0000 Subject: Factor out some of the common homeserver setup code into a setup_test_homeserver function in utils. --- tests/handlers/test_presence.py | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'tests/handlers/test_presence.py') diff --git a/tests/handlers/test_presence.py b/tests/handlers/test_presence.py index 5621a8afaf..d88a977be4 100644 --- a/tests/handlers/test_presence.py +++ b/tests/handlers/test_presence.py @@ -21,11 +21,9 @@ from mock import Mock, call, ANY, NonCallableMock import json from tests.utils import ( - MockHttpResource, MockClock, DeferredMockCallable, SQLiteMemoryDbPool, - MockKey + MockHttpResource, MockClock, DeferredMockCallable, setup_test_homeserver ) -from synapse.server import HomeServer from synapse.api.constants import PresenceState from synapse.api.errors import SynapseError from synapse.handlers.presence import PresenceHandler, UserPresenceCache @@ -66,30 +64,20 @@ class PresenceTestCase(unittest.TestCase): def setUp(self): self.clock = MockClock() - self.mock_config = NonCallableMock() - self.mock_config.signing_key = [MockKey()] - self.mock_federation_resource = MockHttpResource() self.mock_http_client = Mock(spec=[]) self.mock_http_client.put_json = DeferredMockCallable() - db_pool = None hs_kwargs = {} - if hasattr(self, "make_datastore_mock"): hs_kwargs["datastore"] = self.make_datastore_mock() - else: - db_pool = SQLiteMemoryDbPool() - yield db_pool.prepare() - hs = HomeServer("test", + hs = yield setup_test_homeserver( clock=self.clock, - db_pool=db_pool, handlers=None, resource_for_federation=self.mock_federation_resource, http_client=self.mock_http_client, - config=self.mock_config, keyring=Mock(), **hs_kwargs ) -- cgit 1.4.1