From 493b1e6d3ccb9fd806e6d4c22daa1b6657c6ae7f Mon Sep 17 00:00:00 2001 From: "Paul \"LeoNerd\" Evans" Date: Thu, 11 Sep 2014 15:21:15 +0100 Subject: Need to prepare() the SQLiteMemoryDbPool before passing it to HomeServer constructor, as DataStore's constructor will want it ready --- tests/handlers/test_directory.py | 7 ++++--- tests/handlers/test_presence.py | 7 ++++--- tests/handlers/test_profile.py | 7 ++++--- tests/storage/test_directory.py | 7 ++++--- tests/storage/test_presence.py | 7 ++++--- tests/storage/test_profile.py | 7 ++++--- 6 files changed, 24 insertions(+), 18 deletions(-) (limited to 'tests') diff --git a/tests/handlers/test_directory.py b/tests/handlers/test_directory.py index 58ecf561ff..f7eb7b4f03 100644 --- a/tests/handlers/test_directory.py +++ b/tests/handlers/test_directory.py @@ -50,16 +50,17 @@ class DirectoryTestCase(unittest.TestCase): self.query_handlers[query_type] = handler self.mock_federation.register_query_handler = register_query_handler + db_pool = SQLiteMemoryDbPool() + yield db_pool.prepare() + hs = HomeServer("test", - db_pool=SQLiteMemoryDbPool(), + db_pool=db_pool, http_client=None, resource_for_federation=Mock(), replication_layer=self.mock_federation, ) hs.handlers = DirectoryHandlers(hs) - yield hs.get_db_pool().prepare() - self.handler = hs.get_handlers().directory_handler self.store = hs.get_datastore() diff --git a/tests/handlers/test_presence.py b/tests/handlers/test_presence.py index c98f877e84..61e9cc7042 100644 --- a/tests/handlers/test_presence.py +++ b/tests/handlers/test_presence.py @@ -68,17 +68,18 @@ class PresenceStateTestCase(unittest.TestCase): @defer.inlineCallbacks def setUp(self): + db_pool = SQLiteMemoryDbPool() + yield db_pool.prepare() + hs = HomeServer("test", clock=MockClock(), - db_pool=SQLiteMemoryDbPool(), + db_pool=db_pool, handlers=None, resource_for_federation=Mock(), http_client=None, ) hs.handlers = JustPresenceHandlers(hs) - yield hs.get_db_pool().prepare() - self.store = hs.get_datastore() # Mock the RoomMemberHandler diff --git a/tests/handlers/test_profile.py b/tests/handlers/test_profile.py index 8b9685a527..63c9295944 100644 --- a/tests/handlers/test_profile.py +++ b/tests/handlers/test_profile.py @@ -49,8 +49,11 @@ class ProfileTestCase(unittest.TestCase): self.query_handlers[query_type] = handler self.mock_federation.register_query_handler = register_query_handler + db_pool = SQLiteMemoryDbPool() + yield db_pool.prepare() + hs = HomeServer("test", - db_pool=SQLiteMemoryDbPool(), + db_pool=db_pool, http_client=None, handlers=None, resource_for_federation=Mock(), @@ -58,8 +61,6 @@ class ProfileTestCase(unittest.TestCase): ) hs.handlers = ProfileHandlers(hs) - yield hs.get_db_pool().prepare() - self.store = hs.get_datastore() self.frank = hs.parse_userid("@1234ABCD:test") diff --git a/tests/storage/test_directory.py b/tests/storage/test_directory.py index 49c41700f6..c4c321dda6 100644 --- a/tests/storage/test_directory.py +++ b/tests/storage/test_directory.py @@ -27,12 +27,13 @@ class DirectoryStoreTestCase(unittest.TestCase): @defer.inlineCallbacks def setUp(self): + db_pool = SQLiteMemoryDbPool() + yield db_pool.prepare() + hs = HomeServer("test", - db_pool=SQLiteMemoryDbPool(), + db_pool=db_pool, ) - yield hs.get_db_pool().prepare() - self.store = DirectoryStore(hs) self.room = hs.parse_roomid("!abcde:test") diff --git a/tests/storage/test_presence.py b/tests/storage/test_presence.py index f0a04ae830..f3fab4fe79 100644 --- a/tests/storage/test_presence.py +++ b/tests/storage/test_presence.py @@ -27,13 +27,14 @@ class PresenceStoreTestCase(unittest.TestCase): @defer.inlineCallbacks def setUp(self): + db_pool = SQLiteMemoryDbPool() + yield db_pool.prepare() + hs = HomeServer("test", clock=MockClock(), - db_pool=SQLiteMemoryDbPool(), + db_pool=db_pool, ) - yield hs.get_db_pool().prepare() - self.store = PresenceStore(hs) self.u_apple = hs.parse_userid("@apple:test") diff --git a/tests/storage/test_profile.py b/tests/storage/test_profile.py index fa96abf03b..1855278044 100644 --- a/tests/storage/test_profile.py +++ b/tests/storage/test_profile.py @@ -27,12 +27,13 @@ class ProfileStoreTestCase(unittest.TestCase): @defer.inlineCallbacks def setUp(self): + db_pool = SQLiteMemoryDbPool() + yield db_pool.prepare() + hs = HomeServer("test", - db_pool=SQLiteMemoryDbPool(), + db_pool=db_pool, ) - yield hs.get_db_pool().prepare() - self.store = ProfileStore(hs) self.u_frank = hs.parse_userid("@frank:test") -- cgit 1.4.1