chainqueue/tests/test_fs_entry.py

42 lines
977 B
Python
Raw Normal View History

2021-06-02 12:59:04 +02:00
# standard imports
import unittest
import tempfile
import shutil
import logging
import os
2021-08-26 10:05:56 +02:00
# external imports
from leveldir.hex import HexDir
2021-06-02 12:59:04 +02:00
# local imports
from chainqueue.fs.queue import FsQueue
from chainqueue.fs.entry import Entry
from chainqueue.enum import StatusBits
logging.basicConfig(level=logging.DEBUG)
logg = logging.getLogger()
class FsQueueEntryTest(unittest.TestCase):
def setUp(self):
self.dir = tempfile.mkdtemp()
self.hexdir = HexDir(os.path.join(self.dir, 'q'), 32, 2, 8)
self.q = FsQueue(os.path.join(self.dir, 'spool'), backend=self.hexdir)
logg.debug('setup fsqueue root {}'.format(self.dir))
def tearDown(self):
shutil.rmtree(self.dir)
logg.debug('cleaned fsqueue root {}'.format(self.dir))
def test_entry(self):
2021-08-26 10:05:56 +02:00
tx_hash = os.urandom(32).hex()
tx_content = os.urandom(128).hex()
Entry(0, tx_hash, tx_content)
2021-06-02 12:59:04 +02:00
if __name__ == '__main__':
unittest.main()