From 716dd6c3fa84f6be591e2aba018880edc70a77f8 Mon Sep 17 00:00:00 2001 From: Akio Nakamura Date: Thu, 6 Jun 2019 19:19:50 +0900 Subject: [PATCH] Add some tests for assetlabel support --- test/functional/feature_confidential_transactions.py | 7 +++++++ test/functional/wallet_labels.py | 3 +++ 2 files changed, 10 insertions(+) diff --git a/test/functional/feature_confidential_transactions.py b/test/functional/feature_confidential_transactions.py index 2264fba1745..f8a306d76a5 100755 --- a/test/functional/feature_confidential_transactions.py +++ b/test/functional/feature_confidential_transactions.py @@ -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])) @@ -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) @@ -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() diff --git a/test/functional/wallet_labels.py b/test/functional/wallet_labels.py index 9f3103169b6..292ae21f3cb 100755 --- a/test/functional/wallet_labels.py +++ b/test/functional/wallet_labels.py @@ -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)]