aboutsummaryrefslogtreecommitdiff
path: root/qa/rpc-tests/blockchain.py
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2017-03-07 14:08:59 -0500
committerJohn Newbery <john@johnnewbery.com>2017-03-15 11:56:25 -0400
commitc9bd0f64212cd600daf30c9c59035bfe9f07b81b (patch)
tree9f587fadcbbd92fb983a770af4a1cf5084bc8b01 /qa/rpc-tests/blockchain.py
parentce01e6226ce52b88c644b0cb89852278edbdf33b (diff)
Fix RPC failure testing (2 of 2)
Commit 9db8eecac1c713c760c0217b6acb7455c657fa8b 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().
Diffstat (limited to 'qa/rpc-tests/blockchain.py')
-rwxr-xr-xqa/rpc-tests/blockchain.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/qa/rpc-tests/blockchain.py b/qa/rpc-tests/blockchain.py
index 67b5826840..596aed50ec 100755
--- a/qa/rpc-tests/blockchain.py
+++ b/qa/rpc-tests/blockchain.py
@@ -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)