Skip to content

Commit

Permalink
Add some tests for assetlabel support
Browse files Browse the repository at this point in the history
  • Loading branch information
AkioNak committed Jun 21, 2019
1 parent 43b22fb commit 716dd6c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/functional/feature_confidential_transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ def run_test(self):

# Check 2's listreceivedbyaddress
received_by_address = self.nodes[2].listreceivedbyaddress(0, False, False, "", "bitcoin")
validate_by_address = [(address2, value1 + value3), (address, value0 + value2)]
assert_equal(sorted([(ele['address'], ele['amount']) for ele in received_by_address], key=lambda t: t[0]),
sorted(validate_by_address, key = lambda t: t[0]))
received_by_address = self.nodes[2].listreceivedbyaddress(0, False, False, "")
validate_by_address = [(address2, {"bitcoin": value1 + value3}), (address, {"bitcoin": value0 + value2})]
assert_equal(sorted([(ele['address'], ele['amount']) for ele in received_by_address], key=lambda t: t[0]),
sorted(validate_by_address, key = lambda t: t[0]))
Expand Down Expand Up @@ -215,6 +219,7 @@ def run_test(self):
assert(found_unblinded)

assert_equal(self.nodes[1].gettransaction(raw_tx_id, True)['amount']["bitcoin"], value3)
assert_equal(self.nodes[1].gettransaction(raw_tx_id, True, "bitcoin")['amount'], value3)
list_unspent = self.nodes[1].listunspent(1, 9999999, [], True, {"asset": "bitcoin"})
assert_equal(list_unspent[0]['amount']+list_unspent[1]['amount'], value1+value3)
received_by_address = self.nodes[1].listreceivedbyaddress(1, False, True)
Expand Down Expand Up @@ -357,7 +362,9 @@ def run_test(self):
# Assets balance checking, note that accounts are completely ignored because
# balance queries with accounts are horrifically broken upstream
assert_equal(self.nodes[0].getbalance("*", 0, False, "bitcoin"), self.nodes[0].getbalance("*", 0, False, "bitcoin"))
assert_equal(self.nodes[0].getbalance("*", 0, False)['bitcoin'], self.nodes[0].getbalance("*", 0, False, "bitcoin"))
assert_equal(self.nodes[0].getwalletinfo()['balance']['bitcoin'], self.nodes[0].getbalance("*", 0, False, "bitcoin"))
assert_equal(self.nodes[0].getwalletinfo("bitcoin")['balance'], self.nodes[0].getbalance("*", 0, False, "bitcoin"))

# Send some bitcoin and other assets over as well to fund wallet
addr = self.nodes[2].getnewaddress()
Expand Down
3 changes: 3 additions & 0 deletions test/functional/wallet_labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ def run_test(self):
for label in labels:
assert_equal(
node.getreceivedbyaddress(label.addresses[0])['bitcoin'], amount_to_send)
assert_equal(
node.getreceivedbyaddress(label.addresses[0], 1, "bitcoin"), amount_to_send)
assert_equal(node.getreceivedbylabel(label.name)['bitcoin'], amount_to_send)
assert_equal(node.getreceivedbylabel(label.name, 1, "bitcoin"), amount_to_send)

for i, label in enumerate(labels):
to_label = labels[(i + 1) % len(labels)]
Expand Down

0 comments on commit 716dd6c

Please sign in to comment.