Add rpc cache test
This commit is contained in:
parent
50804f4d70
commit
8946dfac77
@ -21,6 +21,7 @@ from chainlib.eth.tx import (
|
||||
)
|
||||
from chainlib.eth.block import (
|
||||
block_by_hash,
|
||||
block_by_number,
|
||||
Block,
|
||||
)
|
||||
from chainlib.eth.address import is_same_address
|
||||
@ -28,6 +29,7 @@ from hexathon import strip_0x
|
||||
|
||||
# local imports
|
||||
from eth_cache.store.file import FileStore
|
||||
from eth_cache.rpc import CacheRPC
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
logg = logging.getLogger()
|
||||
@ -136,5 +138,21 @@ class TestCache(EthTesterCase):
|
||||
self.assertEqual(len(txs), 2)
|
||||
|
||||
|
||||
def test_cache_rpc(self):
|
||||
rpc = CacheRPC(None, self.store)
|
||||
|
||||
o = block_by_hash(self.block.hash)
|
||||
block_src = self.rpc.do(o)
|
||||
self.assertEqual(block_src['hash'], self.block.hash)
|
||||
|
||||
o = block_by_number(self.block.number)
|
||||
block_src = self.rpc.do(o)
|
||||
self.assertEqual(block_src['hash'], self.block.hash)
|
||||
|
||||
o = transaction(self.tx.hash)
|
||||
tx_src = self.rpc.do(o)
|
||||
self.assertTrue(is_same_address(tx_src['hash'], self.tx.hash))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
Loading…
Reference in New Issue
Block a user