From ed3a601f7fece849938fe67649b19f2aad55a47a Mon Sep 17 00:00:00 2001 From: Daniel Van Der Maden Date: Thu, 27 Aug 2020 11:38:34 -0700 Subject: [PATCH] [localnet] Add test_get_block_signers --- localnet/tests/test_blockchain.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/localnet/tests/test_blockchain.py b/localnet/tests/test_blockchain.py index 6d12fcf..b479232 100644 --- a/localnet/tests/test_blockchain.py +++ b/localnet/tests/test_blockchain.py @@ -301,6 +301,27 @@ def test_get_header_by_number(): assert response["shardID"] == 0 +def test_get_block_signers(): + """ + Note that v1 & v2 have the same responses. + """ + reference_response = [ + "one1gh043zc95e6mtutwy5a2zhvsxv7lnlklkj42ux" + ] + + # Check v1 + raw_response = base_request("hmy_getBlockSigners", params=["0x1"], endpoint=endpoints[0]) + response = check_and_unpack_rpc_response(raw_response, expect_error=False) + assert_valid_json_structure(reference_response, response) + assert len(response) > 0, "expect at least 1 signer" + + # Check v2 + raw_response = base_request("hmyv2_getBlockSigners", params=[1], endpoint=endpoints[0]) + response = check_and_unpack_rpc_response(raw_response, expect_error=False) + assert_valid_json_structure(reference_response, response) + assert len(response) > 0, "expect at least 1 signer" + + def test_get_block_number_v1(): raw_response = base_request("hmy_blockNumber", endpoint=endpoints[0]) response = check_and_unpack_rpc_response(raw_response, expect_error=False)