Fix RPC failure testing

Make sure that RPC tests are actually checking failures correctly by:

- Catching JSON RPC exceptions and verifying the error codes and messages.
- Failing the test case if the JSON RPC exception isn't raised.
This commit is contained in:
John Newbery
2017-02-07 09:56:53 -05:00
parent 729de15b63
commit 9db8eecac1
2 changed files with 21 additions and 4 deletions

View File

@@ -37,7 +37,7 @@ class NamedArgumentTest(BitcoinTestFramework):
h = node.help(command='getinfo')
assert(h.startswith('getinfo\n'))
assert_raises_jsonrpc(-8, node.help, random='getinfo')
assert_raises_jsonrpc(-8, 'Unknown named parameter', node.help, random='getinfo')
h = node.getblockhash(height=0)
node.getblock(blockhash=h)