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:
John Newbery
2017-03-07 14:08:59 -05:00
parent ce01e6226c
commit c9bd0f6421
16 changed files with 119 additions and 265 deletions

View File

@@ -107,13 +107,9 @@ class PrioritiseTransactionTest(BitcoinTestFramework):
tx_hex = self.nodes[0].signrawtransaction(raw_tx)["hex"]
tx_id = self.nodes[0].decoderawtransaction(tx_hex)["txid"]
try:
self.nodes[0].sendrawtransaction(tx_hex)
except JSONRPCException as exp:
assert_equal(exp.error['code'], -26) # insufficient fee
assert(tx_id not in self.nodes[0].getrawmempool())
else:
assert(False)
# This will raise an exception due to min relay fee not being met
assert_raises_jsonrpc(-26, "66: min relay fee not met", self.nodes[0].sendrawtransaction, tx_hex)
assert(tx_id not in self.nodes[0].getrawmempool())
# This is a less than 1000-byte transaction, so just set the fee
# to be the minimum for a 1000 byte transaction and check that it is