From 28ba22c20209c88a6a903729d3935e836ed0cf1a Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Sun, 3 Apr 2016 21:20:14 +0200 Subject: [PATCH] [qa] Remove misleading "errorString syntax" Github-Pull: #7801 Rebased-From: ffff866da83209dcaa463d8b9539d3f539f83a97 --- qa/rpc-tests/rawtransactions.py | 6 +++--- qa/rpc-tests/wallet.py | 14 ++++++-------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/qa/rpc-tests/rawtransactions.py b/qa/rpc-tests/rawtransactions.py index b76cc1f58..e38ef6c8b 100755 --- a/qa/rpc-tests/rawtransactions.py +++ b/qa/rpc-tests/rawtransactions.py @@ -56,13 +56,13 @@ class RawTransactionsTest(BitcoinTestFramework): rawtx = self.nodes[2].createrawtransaction(inputs, outputs) rawtx = self.nodes[2].signrawtransaction(rawtx) - errorString = "" try: rawtx = self.nodes[2].sendrawtransaction(rawtx['hex']) except JSONRPCException as e: - errorString = e.error['message'] + assert("Missing inputs" in e.error['message']) + else: + assert(False) - assert("Missing inputs" in errorString) ######################### # RAW TX MULTISIG TESTS # diff --git a/qa/rpc-tests/wallet.py b/qa/rpc-tests/wallet.py index e9748208c..3cf0261f1 100755 --- a/qa/rpc-tests/wallet.py +++ b/qa/rpc-tests/wallet.py @@ -246,22 +246,20 @@ class WalletTest (BitcoinTestFramework): txObj = self.nodes[0].gettransaction(txId) assert_equal(txObj['amount'], Decimal('-0.0001')) - #this should fail - errorString = "" try: txId = self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), "1f-4") except JSONRPCException as e: - errorString = e.error['message'] + assert("Invalid amount" in e.error['message']) + else: + raise AssertionError("Must not parse invalid amounts") - assert("Invalid amount" in errorString) - errorString = "" try: - self.nodes[0].generate("2") #use a string to as block amount parameter must fail because it's not interpreted as amount + self.nodes[0].generate("2") + raise AssertionError("Must not accept strings as numeric") except JSONRPCException as e: - errorString = e.error['message'] + assert("not an integer" in e.error['message']) - assert("not an integer" in errorString) #check if wallet or blochchain maintenance changes the balance self.sync_all()