Prepare integration test

This commit is contained in:
lash
2022-03-12 13:48:40 +00:00
parent 69ad3711cd
commit 0c9b42d086
8 changed files with 128 additions and 168 deletions

40
tests/common.py Normal file
View File

@@ -0,0 +1,40 @@
# local imports
from chainqueue.cache import Cache
class MockCounter:
def __init__(self):
self.c = 0
def next(self):
c = self.c
self.c += 1
return c
class MockTokenCache(Cache):
def __init__(self):
self.db = {}
self.last_filter = None
def put(self, chain_spec, cache_tx):
self.db[cache_tx.tx_hash] = cache_tx
def get(self, chain_spec, tx_hash):
return self.db[tx_hash]
def by_nonce(self, cache_filter):
self.last_filter = cache_filter
def by_date(self, cache_filter=None):
self.last_filter = cache_filter
def count(self, cache_filter):
self.last_filter = cache_filter