chainqueue/tests/base_shep.py

40 lines
920 B
Python
Raw Normal View History

2022-03-11 20:38:12 +01:00
# standard imports
import tempfile
import unittest
import shutil
2022-04-10 16:00:01 +02:00
import logging
2022-03-11 20:38:12 +01:00
# external imports
from shep.store.file import SimpleFileStoreFactory
2022-03-12 14:48:40 +01:00
from chainlib.chain import ChainSpec
2022-03-11 20:38:12 +01:00
# local imports
from chainqueue import (
Store,
Status,
)
2022-03-12 14:48:40 +01:00
# test imports
from tests.common import (
MockCounter,
MockContentStore,
)
2022-03-11 20:38:12 +01:00
2022-04-10 16:00:01 +02:00
logg = logging.getLogger(__name__)
2022-03-11 20:38:12 +01:00
class TestShepBase(unittest.TestCase):
def setUp(self):
self.path = tempfile.mkdtemp()
factory = SimpleFileStoreFactory(self.path).add
self.state = Status(factory)
2022-03-12 09:48:19 +01:00
content_store = MockContentStore()
counter = MockCounter()
2022-03-12 14:48:40 +01:00
chain_spec = ChainSpec('foo', 'bar', 42, 'baz')
self.store = Store(chain_spec, self.state, content_store, counter)
2022-04-10 16:00:01 +02:00
logg.debug('using path {}'.format(self.path))
def tearDown(self):
shutil.rmtree(self.path)