fixing the broken test after the rpc reponse structure was updated in the main repo

pull/10/head
Ganesha Upadhyaya 4 years ago committed by Leo Chen
parent d11b7387a4
commit 8a3c73abe4
  1. 55
      localnet/rpc_tests/test_blockchain.py

@ -196,24 +196,51 @@ def test_get_latest_chain_headers():
Note that v1 & v2 have the same responses. Note that v1 & v2 have the same responses.
""" """
reference_response = { reference_response = {
"beacon-chain-header": { "id": "0",
"shard-id": 0, "jsonrpc": "2.0",
"block-header-hash": "0x127437058641851cdfe10e9509aa060b169acbce79eb63d04e3be2cfbe596695", "result": {
"block-number": 171, "beacon-chain-header": {
"view-id": 171, "epoch": 18,
"epoch": 33 "extraData": "0x",
}, "gasLimit": "0x4c4b400",
"shard-chain-header": { "gasUsed": "0x0",
"shard-id": 1, "hash": "0xdb6099006bb637578a94fa3003b2b68947ae8fcdc7e9f89ea0f83edd5ad65c9e",
"block-header-hash": "0x0ca6c681e128f47e35e4c578b6381f3f8dda8ec9fcb0a8935a0bf12a2e7a19a3", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"block-number": 171, "miner": "0x6911b75b2560be9a8f71164a33086be4511fc99a",
"view-id": 171, "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"epoch": 33 "number": "0xab",
"parentHash": "0x9afbaa3db3c2f5393b7b765aa48091c7a6cc3c3fdf19fb88f8ee2c88e257988d",
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"shardID": 0,
"stateRoot": "0x4d0b5b168bd3214e32f95718ef591e04c54f060f89e4304c8d4ff2745ebad3a9",
"timestamp": "0x60751990",
"transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"viewID": 171
},
"shard-chain-header": {
"epoch": 17,
"extraData": "0x",
"gasLimit": "0x4c4b400",
"gasUsed": "0x0",
"hash": "0xdf4c2be8e676f728a419415bdd393a5c174e0b1431e016f870d0777d86668708",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"miner": "0xd06193871db8d5bc92dead4780e3624038174e88",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"number": "0xa7",
"parentHash": "0x336990a12d8697c5f9247790261aa1bdea33aed37031d09664680b86779f08a6",
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"shardID": 1,
"stateRoot": "0xddd8a842df3ffd77555d64ab782abf6effe95bc2eab48610ac05a5445b55df92",
"timestamp": "0x60751991",
"transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"viewID": 167
}
} }
} }
# Check v1 # Check v1
raw_response = base_request("hmy_getLatestChainHeaders", endpoint=endpoints[1]) raw_response = base_request(
"hmy_getLatestChainHeaders", endpoint=endpoints[1])
response = check_and_unpack_rpc_response(raw_response, expect_error=False) response = check_and_unpack_rpc_response(raw_response, expect_error=False)
assert_valid_json_structure(reference_response, response) assert_valid_json_structure(reference_response, response)
assert response["beacon-chain-header"]["shard-id"] == 0 assert response["beacon-chain-header"]["shard-id"] == 0

Loading…
Cancel
Save