chainqueue

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

test_fs_entry.py (977B)


      1 # standard imports
      2 import unittest
      3 import tempfile
      4 import shutil
      5 import logging
      6 import os
      7 
      8 # external imports
      9 from leveldir.hex import HexDir
     10 
     11 # local imports
     12 from chainqueue.fs.queue import FsQueue
     13 from chainqueue.fs.entry import Entry
     14 from chainqueue.enum import StatusBits
     15 
     16 logging.basicConfig(level=logging.DEBUG)
     17 logg = logging.getLogger()
     18 
     19 
     20 class FsQueueEntryTest(unittest.TestCase):
     21 
     22     def setUp(self):
     23         self.dir = tempfile.mkdtemp() 
     24         self.hexdir = HexDir(os.path.join(self.dir, 'q'), 32, 2, 8)
     25         self.q = FsQueue(os.path.join(self.dir, 'spool'), backend=self.hexdir)
     26         logg.debug('setup fsqueue root {}'.format(self.dir))
     27 
     28 
     29     def tearDown(self):
     30         shutil.rmtree(self.dir)
     31         logg.debug('cleaned fsqueue root {}'.format(self.dir))
     32 
     33 
     34     def test_entry(self):
     35         tx_hash = os.urandom(32).hex()
     36         tx_content = os.urandom(128).hex()
     37         Entry(0, tx_hash, tx_content)
     38 
     39 
     40 if __name__ == '__main__':
     41     unittest.main()