Need to prepare() the SQLiteMemoryDbPool before passing it to HomeServer constructor, as DataStore's constructor will want it ready
This commit is contained in:
parent
4385eadc28
commit
493b1e6d3c
|
@ -50,16 +50,17 @@ class DirectoryTestCase(unittest.TestCase):
|
||||||
self.query_handlers[query_type] = handler
|
self.query_handlers[query_type] = handler
|
||||||
self.mock_federation.register_query_handler = register_query_handler
|
self.mock_federation.register_query_handler = register_query_handler
|
||||||
|
|
||||||
|
db_pool = SQLiteMemoryDbPool()
|
||||||
|
yield db_pool.prepare()
|
||||||
|
|
||||||
hs = HomeServer("test",
|
hs = HomeServer("test",
|
||||||
db_pool=SQLiteMemoryDbPool(),
|
db_pool=db_pool,
|
||||||
http_client=None,
|
http_client=None,
|
||||||
resource_for_federation=Mock(),
|
resource_for_federation=Mock(),
|
||||||
replication_layer=self.mock_federation,
|
replication_layer=self.mock_federation,
|
||||||
)
|
)
|
||||||
hs.handlers = DirectoryHandlers(hs)
|
hs.handlers = DirectoryHandlers(hs)
|
||||||
|
|
||||||
yield hs.get_db_pool().prepare()
|
|
||||||
|
|
||||||
self.handler = hs.get_handlers().directory_handler
|
self.handler = hs.get_handlers().directory_handler
|
||||||
|
|
||||||
self.store = hs.get_datastore()
|
self.store = hs.get_datastore()
|
||||||
|
|
|
@ -68,17 +68,18 @@ class PresenceStateTestCase(unittest.TestCase):
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
db_pool = SQLiteMemoryDbPool()
|
||||||
|
yield db_pool.prepare()
|
||||||
|
|
||||||
hs = HomeServer("test",
|
hs = HomeServer("test",
|
||||||
clock=MockClock(),
|
clock=MockClock(),
|
||||||
db_pool=SQLiteMemoryDbPool(),
|
db_pool=db_pool,
|
||||||
handlers=None,
|
handlers=None,
|
||||||
resource_for_federation=Mock(),
|
resource_for_federation=Mock(),
|
||||||
http_client=None,
|
http_client=None,
|
||||||
)
|
)
|
||||||
hs.handlers = JustPresenceHandlers(hs)
|
hs.handlers = JustPresenceHandlers(hs)
|
||||||
|
|
||||||
yield hs.get_db_pool().prepare()
|
|
||||||
|
|
||||||
self.store = hs.get_datastore()
|
self.store = hs.get_datastore()
|
||||||
|
|
||||||
# Mock the RoomMemberHandler
|
# Mock the RoomMemberHandler
|
||||||
|
|
|
@ -49,8 +49,11 @@ class ProfileTestCase(unittest.TestCase):
|
||||||
self.query_handlers[query_type] = handler
|
self.query_handlers[query_type] = handler
|
||||||
self.mock_federation.register_query_handler = register_query_handler
|
self.mock_federation.register_query_handler = register_query_handler
|
||||||
|
|
||||||
|
db_pool = SQLiteMemoryDbPool()
|
||||||
|
yield db_pool.prepare()
|
||||||
|
|
||||||
hs = HomeServer("test",
|
hs = HomeServer("test",
|
||||||
db_pool=SQLiteMemoryDbPool(),
|
db_pool=db_pool,
|
||||||
http_client=None,
|
http_client=None,
|
||||||
handlers=None,
|
handlers=None,
|
||||||
resource_for_federation=Mock(),
|
resource_for_federation=Mock(),
|
||||||
|
@ -58,8 +61,6 @@ class ProfileTestCase(unittest.TestCase):
|
||||||
)
|
)
|
||||||
hs.handlers = ProfileHandlers(hs)
|
hs.handlers = ProfileHandlers(hs)
|
||||||
|
|
||||||
yield hs.get_db_pool().prepare()
|
|
||||||
|
|
||||||
self.store = hs.get_datastore()
|
self.store = hs.get_datastore()
|
||||||
|
|
||||||
self.frank = hs.parse_userid("@1234ABCD:test")
|
self.frank = hs.parse_userid("@1234ABCD:test")
|
||||||
|
|
|
@ -27,11 +27,12 @@ class DirectoryStoreTestCase(unittest.TestCase):
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
hs = HomeServer("test",
|
db_pool = SQLiteMemoryDbPool()
|
||||||
db_pool=SQLiteMemoryDbPool(),
|
yield db_pool.prepare()
|
||||||
)
|
|
||||||
|
|
||||||
yield hs.get_db_pool().prepare()
|
hs = HomeServer("test",
|
||||||
|
db_pool=db_pool,
|
||||||
|
)
|
||||||
|
|
||||||
self.store = DirectoryStore(hs)
|
self.store = DirectoryStore(hs)
|
||||||
|
|
||||||
|
|
|
@ -27,13 +27,14 @@ class PresenceStoreTestCase(unittest.TestCase):
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
db_pool = SQLiteMemoryDbPool()
|
||||||
|
yield db_pool.prepare()
|
||||||
|
|
||||||
hs = HomeServer("test",
|
hs = HomeServer("test",
|
||||||
clock=MockClock(),
|
clock=MockClock(),
|
||||||
db_pool=SQLiteMemoryDbPool(),
|
db_pool=db_pool,
|
||||||
)
|
)
|
||||||
|
|
||||||
yield hs.get_db_pool().prepare()
|
|
||||||
|
|
||||||
self.store = PresenceStore(hs)
|
self.store = PresenceStore(hs)
|
||||||
|
|
||||||
self.u_apple = hs.parse_userid("@apple:test")
|
self.u_apple = hs.parse_userid("@apple:test")
|
||||||
|
|
|
@ -27,11 +27,12 @@ class ProfileStoreTestCase(unittest.TestCase):
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
hs = HomeServer("test",
|
db_pool = SQLiteMemoryDbPool()
|
||||||
db_pool=SQLiteMemoryDbPool(),
|
yield db_pool.prepare()
|
||||||
)
|
|
||||||
|
|
||||||
yield hs.get_db_pool().prepare()
|
hs = HomeServer("test",
|
||||||
|
db_pool=db_pool,
|
||||||
|
)
|
||||||
|
|
||||||
self.store = ProfileStore(hs)
|
self.store = ProfileStore(hs)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue