From 7dc62676bac8c66d76dbc6abb2ceee819ca8d839 Mon Sep 17 00:00:00 2001 From: lash Date: Thu, 12 May 2022 18:29:11 +0000 Subject: [PATCH] Rehabilitate tests --- CHANGELOG | 1 + tests/test_block.py | 4 ++++ tests/test_stat.py | 9 +++++++++ tests/test_tx.py | 6 ++++++ 4 files changed, 20 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index d236d56..580a152 100644 --- 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 index 81871b2..7abe7f5 100644 --- 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 index df74470..7458d03 100644 --- 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 index da08a88..c67bf88 100644 --- 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'])]