mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 15:09:59 +01:00
Fix RPC failure testing (2 of 2)
Commit 9db8eecac1 improved the
assert_raises_jsonrpc() function for better testing of RPC failure
modes. This commit completes the job by removing remaining broken
try-except RPC testing from the individual test cases and replacing it
with calls to assert_raises_jsonrpc().
This commit is contained in:
@@ -14,10 +14,9 @@ Tests correspond to code in rpc/blockchain.cpp.
|
||||
from decimal import Decimal
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.authproxy import JSONRPCException
|
||||
from test_framework.util import (
|
||||
assert_equal,
|
||||
assert_raises,
|
||||
assert_raises_jsonrpc,
|
||||
assert_is_hex_string,
|
||||
assert_is_hash_string,
|
||||
start_nodes,
|
||||
@@ -58,8 +57,7 @@ class BlockchainTest(BitcoinTestFramework):
|
||||
def _test_getblockheader(self):
|
||||
node = self.nodes[0]
|
||||
|
||||
assert_raises(
|
||||
JSONRPCException, lambda: node.getblockheader('nonsense'))
|
||||
assert_raises_jsonrpc(-5, "Block not found", node.getblockheader, "nonsense")
|
||||
|
||||
besthash = node.getbestblockhash()
|
||||
secondbesthash = node.getblockhash(199)
|
||||
|
||||
Reference in New Issue
Block a user