mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-06 16:34:22 +01:00
test: add coverage for label
in listsinceblock
This commit is contained in:
parent
722e9a418d
commit
fe488b4c4b
1 changed files with 15 additions and 0 deletions
|
@ -49,6 +49,7 @@ class ListSinceBlockTest(BitcoinTestFramework):
|
||||||
self.test_desc()
|
self.test_desc()
|
||||||
self.test_send_to_self()
|
self.test_send_to_self()
|
||||||
self.test_op_return()
|
self.test_op_return()
|
||||||
|
self.test_label()
|
||||||
|
|
||||||
def test_no_blockhash(self):
|
def test_no_blockhash(self):
|
||||||
self.log.info("Test no blockhash")
|
self.log.info("Test no blockhash")
|
||||||
|
@ -465,6 +466,20 @@ class ListSinceBlockTest(BitcoinTestFramework):
|
||||||
|
|
||||||
assert 'address' not in op_ret_tx
|
assert 'address' not in op_ret_tx
|
||||||
|
|
||||||
|
def test_label(self):
|
||||||
|
self.log.info('Test passing "label" argument fetches incoming transactions having the specified label')
|
||||||
|
new_addr = self.nodes[1].getnewaddress(label="new_addr", address_type="bech32")
|
||||||
|
|
||||||
|
self.nodes[2].sendtoaddress(address=new_addr, amount="0.001")
|
||||||
|
self.generate(self.nodes[2], 1)
|
||||||
|
|
||||||
|
for label in ["new_addr", ""]:
|
||||||
|
new_addr_transactions = self.nodes[1].listsinceblock(label=label)["transactions"]
|
||||||
|
assert_equal(len(new_addr_transactions), 1)
|
||||||
|
assert_equal(new_addr_transactions[0]["label"], label)
|
||||||
|
if label == "new_addr":
|
||||||
|
assert_equal(new_addr_transactions[0]["address"], new_addr)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
ListSinceBlockTest().main()
|
ListSinceBlockTest().main()
|
||||||
|
|
Loading…
Add table
Reference in a new issue