I did this a few months ago (here: #9707), but a few new examples have crept back in.
When testing RPC failures, the test case should always assert the error value and message, to ensure that the failure was for the correct reason. Not doing that can hide bugs in the test code and mean that the test is not testing the correct behaviour.
RPC failure testing should use the utility function assert_raises_jsonrpc()
(renamed in the final commit of this PR to assert_raises_rpc_error()
.
This PR does the following:
- changes all remaining instances of tests directly testing on
JSONRPCException
to calls toassert_raises_jsonrpc()
- prevents
assert_raises_message()
from being called withJSONRPCException
- scripted-diff changes
assert_raises_jsonrpc()
toassert_raises_rpc_error()