chainsyncer/tests/store/test_rocksdb.py

36 lines
852 B
Python
Raw Normal View History

2022-04-20 16:27:59 +02:00
# standard imports
import unittest
import logging
# local imports
from chainsyncer.store.rocksdb import SyncRocksDbStore
2022-04-26 09:56:04 +02:00
from chainsyncer.unittest.store import (
TestStoreBase,
filter_change_callback,
state_change_callback,
)
2022-04-20 16:27:59 +02:00
logging.basicConfig(level=logging.DEBUG)
logg = logging.getLogger()
class StoreFactory:
2022-04-20 16:27:59 +02:00
def __init__(self, path):
self.path = path
2022-04-20 16:27:59 +02:00
def create(self, session_id=None):
2022-04-26 09:56:04 +02:00
return SyncRocksDbStore(self.path, session_id=session_id, state_event_callback=state_change_callback, filter_state_event_callback=filter_change_callback)
2022-04-20 16:27:59 +02:00
class TestRocksDb(TestStoreBase):
def setUp(self):
super(TestRocksDb, self).setUp()
self.store_factory = StoreFactory(self.path).create
2022-04-20 16:27:59 +02:00
if __name__ == '__main__':
TestStoreBase.link(TestRocksDb)
2022-04-20 16:27:59 +02:00
unittest.main()