Merge #10853: [tests] Fix RPC failure testing (again)
commitc63364610f4a041df1c1bd81d01b1f6856160749
authorMarcoFalke <falke.marco@gmail.com>
Mon, 9 Oct 2017 18:59:59 +0000 (9 20:59 +0200)
committerMarcoFalke <falke.marco@gmail.com>
Mon, 9 Oct 2017 19:00:04 +0000 (9 21:00 +0200)
tree1e094883830bb7d986d9929f449a7801bdfc5753
parent92eadc395071876d77f3babddc056b4325bdbabc
parent47ba8cf71e9a3a6f7452488fc9ab3b350f0fae36
Merge #10853: [tests] Fix RPC failure testing (again)

47ba8cf71 scripted-diff: rename assert_raises_jsonrpc to assert_raises_rpc error (John Newbery)
677d893ff [tests] do not allow assert_raises_message to be called with JSONRPCException (John Newbery)
5864e9c16 [tests] remove direct testing on JSONRPCException from individual test cases (John Newbery)

Pull request description:

  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 to `assert_raises_jsonrpc()`
  - prevents `assert_raises_message()` from being called with `JSONRPCException`
  - scripted-diff changes `assert_raises_jsonrpc()` to `assert_raises_rpc_error()`

Tree-SHA512: 2cc5e320704ec623a6e5a27d3c2c81cea86b502e29896f03bb5bf92cc36725132c1144410aecdf49e90d4577d512ee467d50d8184e9d5c5d0870bfc931316a5a
test/functional/blockchain.py
test/functional/importprunedfunds.py