chainlib-eth

Ethereum implementation of the chainlib interface
Log | Files | Refs | README | LICENSE

commit 7dc62676bac8c66d76dbc6abb2ceee819ca8d839
parent e03c5b803534430a4cfaac59552395bbd69fc7c1
Author: lash <dev@holbrook.no>
Date:   Thu, 12 May 2022 18:29:11 +0000

Rehabilitate tests

Diffstat:
MCHANGELOG | 1+
Mtests/test_block.py | 4++++
Mtests/test_stat.py | 9+++++++++
Mtests/test_tx.py | 6++++++
4 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG @@ -1,5 +1,6 @@ - 0.3.0 * Implement chainlib with new arg and config handling + * Implement cli tools on settings module - 0.2.0 * Implement chainlib generic tx, block and tx result objects - 0.1.3 diff --git a/tests/test_block.py b/tests/test_block.py @@ -29,6 +29,7 @@ class TestBlock(unittest.TestCase): tx_two_src_hash = os.urandom(32).hex() block_hash = os.urandom(32).hex() + parent_hash = os.urandom(32).hex() block_author = os.urandom(20).hex() block_time = datetime.datetime.utcnow().timestamp() block_src = { @@ -40,6 +41,9 @@ class TestBlock(unittest.TestCase): tx_two_src_hash, ], 'timestamp': block_time, + 'gas_used': '0x1234', + 'gas_limit': '0x2345', + 'parent_hash': parent_hash } block = Block(block_src) diff --git a/tests/test_stat.py b/tests/test_stat.py @@ -21,6 +21,9 @@ class TestStat(unittest.TestCase): 'transactions': [], 'number': 41, 'author': os.urandom(20).hex(), + 'gas_used': '0x1234', + 'gas_limit': '0x2345', + 'parent_hash': None, }) d = datetime.datetime.utcnow() @@ -30,6 +33,9 @@ class TestStat(unittest.TestCase): 'transactions': [], 'number': 42, 'author': os.urandom(20).hex(), + 'gas_used': '0x1234', + 'gas_limit': '0x2345', + 'parent_hash': None, }) s.block_apply(block_a) @@ -43,6 +49,9 @@ class TestStat(unittest.TestCase): 'transactions': [], 'number': 43, 'author': os.urandom(20).hex(), + 'gas_used': '0x1234', + 'gas_limit': '0x2345', + 'parent_hash': None, }) s.block_apply(block_c) diff --git a/tests/test_tx.py b/tests/test_tx.py @@ -130,6 +130,9 @@ class TxTestCase(EthTesterCase): 'timestamp': 13241324, 'transactions': [], 'author': os.urandom(20).hex(), + 'gas_used': 21000, + 'gas_limit': '0x2345', + 'parent_hash': None, }) with self.assertRaises(AttributeError): tx = Tx(tx_data, block=block) @@ -173,6 +176,9 @@ class TxTestCase(EthTesterCase): 'timestamp': 13241324, 'transactions': [], 'author': os.urandom(20).hex(), + 'gas_used': 21000, + 'gas_limit': '0x2345', + 'parent_hash': None, }) block.txs = [add_0x(tx_data['hash'])]