commit 54d344351aa2dd91355b2d0b7307a9dcf13055fa
parent 719db6b9b30ac90a6a9576c9166c8818f45f3c5a
Author: nolash <dev@holbrook.no>
Date: Fri, 16 Apr 2021 07:39:37 +0200
Add basic test fixture
Diffstat:
2 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/crypto_account_cache/cache.py b/crypto_account_cache/cache.py
@@ -24,8 +24,8 @@ class CryptoCache:
def set_store(self, store):
self.store = store
- if not store.initd():
- self.store.dump(self.bloom.to_bytes())
+ if not store.initd:
+ self.store.save(self.bloom.to_bytes())
@staticmethod
diff --git a/tests/test_basic.py b/tests/test_basic.py
@@ -15,15 +15,20 @@ from tests.base import TestBase
class TestBasic(TestBase):
- def test_create_file(self):
- chain_spec = ChainSpec('foo', 'bar', 42, 'baz')
- account = os.urandom(20)
+ def setUp(self):
+ super(TestBasic, self).setUp()
- filename = for_label(chain_spec, account, self.salt)
- filepath = os.path.join(self.session_data_dir, filename)
- store = FileStore(filepath)
+ self.chain_spec = ChainSpec('foo', 'bar', 42, 'baz')
+ self.account = os.urandom(20)
+
+ self.filename = for_label(self.chain_spec, self.account, self.salt)
+ self.filepath = os.path.join(self.session_data_dir, self.filename)
+ self.store = FileStore(self.filepath)
+
+ def test_create_cache(self):
+ cache = CryptoCache(self.chain_spec, self.bits_size)
+ cache.set_store(self.store)
- cache = CryptoCache(chain_spec, self.bits_size)
if __name__ == '__main__':