diff options
author | Jon Atack <jon@atack.com> | 2019-10-28 11:11:20 +0100 |
---|---|---|
committer | Jon Atack <jon@atack.com> | 2019-11-24 23:08:38 +0100 |
commit | 33f5fc32e5bfbe1e89c4d20ce455bcc6dc194151 (patch) | |
tree | 541a9905f6291d56b1227e21827ebaaa100ca15a /test/functional/wallet_importmulti.py | |
parent | 0f3539ac6d772fc646b5f184fa1efe77bf632f6a (diff) |
test: add rpc getaddressinfo labels test coverage
Diffstat (limited to 'test/functional/wallet_importmulti.py')
-rwxr-xr-x | test/functional/wallet_importmulti.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/test/functional/wallet_importmulti.py b/test/functional/wallet_importmulti.py index da795eac1f..5febac5998 100755 --- a/test/functional/wallet_importmulti.py +++ b/test/functional/wallet_importmulti.py @@ -29,6 +29,7 @@ from test_framework.util import ( from test_framework.wallet_util import ( get_key, get_multisig, + labels_value, test_address, ) @@ -121,7 +122,7 @@ class ImportMultiTest(BitcoinTestFramework): self.test_importmulti({"scriptPubKey": key.p2pkh_script, "timestamp": "now", "internal": True, - "label": "Example label"}, + "label": "Unsuccessful labelling for internal addresses"}, success=False, error_code=-8, error_message='Internal addresses should not have a label') @@ -550,7 +551,7 @@ class ImportMultiTest(BitcoinTestFramework): self.log.info("Should not import a p2sh-p2wpkh address from descriptor without checksum and private key") self.test_importmulti({"desc": "sh(wpkh(" + key.pubkey + "))", "timestamp": "now", - "label": "Descriptor import test", + "label": "Unsuccessful P2SH-P2WPKH descriptor import", "keys": [key.privkey]}, success=False, error_code=-5, @@ -558,17 +559,19 @@ class ImportMultiTest(BitcoinTestFramework): # Test importing of a P2SH-P2WPKH address via descriptor + private key key = get_key(self.nodes[0]) + p2sh_p2wpkh_label = "Successful P2SH-P2WPKH descriptor import" self.log.info("Should import a p2sh-p2wpkh address from descriptor and private key") self.test_importmulti({"desc": descsum_create("sh(wpkh(" + key.pubkey + "))"), "timestamp": "now", - "label": "Descriptor import test", + "label": p2sh_p2wpkh_label, "keys": [key.privkey]}, success=True) test_address(self.nodes[1], key.p2sh_p2wpkh_addr, solvable=True, ismine=True, - label="Descriptor import test") + label=p2sh_p2wpkh_label, + labels=labels_value(name=p2sh_p2wpkh_label)) # Test ranged descriptor fails if range is not specified xpriv = "tprv8ZgxMBicQKsPeuVhWwi6wuMQGfPKi9Li5GtX35jVNknACgqe3CY4g5xgkfDDJcmtF7o1QnxWDRYw4H5P26PXq7sbcUkEqeR4fg3Kxp2tigg" @@ -628,17 +631,19 @@ class ImportMultiTest(BitcoinTestFramework): # Test importing of a P2PKH address via descriptor key = get_key(self.nodes[0]) + p2pkh_label = "P2PKH descriptor import" self.log.info("Should import a p2pkh address from descriptor") self.test_importmulti({"desc": descsum_create("pkh(" + key.pubkey + ")"), "timestamp": "now", - "label": "Descriptor import test"}, + "label": p2pkh_label}, True, warnings=["Some private keys are missing, outputs will be considered watchonly. If this is intentional, specify the watchonly flag."]) test_address(self.nodes[1], key.p2pkh_addr, solvable=True, ismine=False, - label="Descriptor import test") + label=p2pkh_label, + labels=labels_value(name=p2pkh_label)) # Test import fails if both desc and scriptPubKey are provided key = get_key(self.nodes[0]) |