chainqueue

Blockchain transaction queue control
Info | Log | Files | Refs | LICENSE

base_shep.py (920B)


      1 # standard imports
      2 import tempfile
      3 import unittest
      4 import shutil
      5 import logging
      6 
      7 # external imports
      8 from shep.store.file import SimpleFileStoreFactory
      9 from chainlib.chain import ChainSpec
     10 
     11 # local imports
     12 from chainqueue import (
     13         Store,
     14         Status,
     15         )
     16 
     17 # test imports
     18 from tests.common import (
     19         MockCounter,
     20         MockContentStore,
     21         )
     22 
     23 logg = logging.getLogger(__name__)
     24 
     25 class TestShepBase(unittest.TestCase):
     26 
     27     def setUp(self):
     28         self.path = tempfile.mkdtemp()
     29         factory = SimpleFileStoreFactory(self.path).add
     30         self.state = Status(factory)
     31         content_store = MockContentStore()
     32         counter = MockCounter()
     33         chain_spec = ChainSpec('foo', 'bar', 42, 'baz')
     34         self.store = Store(chain_spec, self.state, content_store, counter)
     35         logg.debug('using path {}'.format(self.path))
     36 
     37 
     38     def tearDown(self):
     39         shutil.rmtree(self.path)