Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[qa] Remove misleading "errorString syntax" #7801

Merged
merged 1 commit into from Apr 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions qa/rpc-tests/importprunedfunds.py
Expand Up @@ -83,9 +83,10 @@ def run_test (self):
try:
result1 = self.nodes[1].importprunedfunds(rawtxn1, proof1, "")
except JSONRPCException as e:
errorString = e.error['message']
assert('No addresses' in e.error['message'])
else:
assert(False)

assert('No addresses' in errorString)

balance1 = self.nodes[1].getbalance("", 0, True)
assert_equal(balance1, Decimal(0))
Expand Down Expand Up @@ -120,9 +121,10 @@ def run_test (self):
try:
self.nodes[1].removeprunedfunds(txnid1)
except JSONRPCException as e:
errorString = e.error['message']
assert('does not exist' in e.error['message'])
else:
assert(False)

assert('does not exist' in errorString)

balance1 = Decimal(self.nodes[1].getbalance("", 0, True))
assert_equal(balance1, Decimal('0.075'))
Expand Down
6 changes: 3 additions & 3 deletions qa/rpc-tests/rawtransactions.py
Expand Up @@ -56,13 +56,13 @@ def run_test(self):
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 #
Expand Down
19 changes: 7 additions & 12 deletions qa/rpc-tests/wallet.py
Expand Up @@ -245,22 +245,20 @@ def run_test (self):
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)

# Mine a block from node0 to an address from node1
cbAddr = self.nodes[1].getnewaddress()
Expand All @@ -269,10 +267,7 @@ def run_test (self):
self.sync_all()

# Check that the txid and balance is found by node1
try:
self.nodes[1].gettransaction(cbTxId)
except JSONRPCException as e:
assert("Invalid or non-wallet transaction id" not in e.error['message'])
self.nodes[1].gettransaction(cbTxId)

#check if wallet or blochchain maintenance changes the balance
self.sync_all()
Expand Down