Skip to content

Commit

Permalink
Add tests of listreceivedbyaddress address filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyRubin committed Feb 16, 2017
1 parent c60de5d commit e6f053a
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions qa/rpc-tests/receivedby.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,24 @@ def run_test(self):
assert_array_result(self.nodes[1].listreceivedbyaddress(11),{"address":addr},{ },True)

#Empty Tx
addr = self.nodes[1].getnewaddress()
empty_addr = self.nodes[1].getnewaddress()
assert_array_result(self.nodes[1].listreceivedbyaddress(0,True),
{"address":addr},
{"address":addr, "account":"", "amount":0, "confirmations":0, "txids":[]})
{"address":empty_addr},
{"address":empty_addr, "account":"", "amount":0, "confirmations":0, "txids":[]})

#Test Address filtering
#Only on addr
expected = {"address":addr, "account":"", "amount":Decimal("0.1"), "confirmations":10, "txids":[txid,]}
res = self.nodes[1].listreceivedbyaddress(0, True, True, addr)
assert_array_result(res, {"address":addr}, expected)
if len(res) != 1:
raise AssertionError("listreceivedbyaddress expected only 1 result")

#Not on addr
other_addr = self.nodes[0].getnewaddress() # note on node[0]! just a random addr
res = self.nodes[1].listreceivedbyaddress(0, True, True, other_addr)
if res != []:
raise AssertionError("Should not have listed any transactions, got\n%s"%res)

'''
getreceivedbyaddress Test
Expand Down

0 comments on commit e6f053a

Please sign in to comment.