[tests] fix flake8 warnings in wallet_importmulti.py
This commit is contained in:
parent
86ff0413bb
commit
cb41ade6b1
1 changed files with 32 additions and 46 deletions
|
@ -51,7 +51,6 @@ class ImportMultiTest(BitcoinTestFramework):
|
|||
assert_equal(address_info['iswatchonly'], False)
|
||||
assert_equal(address_info['ismine'], False)
|
||||
|
||||
|
||||
# RPC importmulti -----------------------------------------------
|
||||
|
||||
# Bitcoin Address (implicit non-internal)
|
||||
|
@ -127,7 +126,6 @@ class ImportMultiTest(BitcoinTestFramework):
|
|||
assert_equal(address_assert['ismine'], False)
|
||||
assert_equal('timestamp' in address_assert, False)
|
||||
|
||||
|
||||
# Address + Public key + !Internal(explicit)
|
||||
self.log.info("Should import an address with public key")
|
||||
address = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
|
@ -145,7 +143,6 @@ class ImportMultiTest(BitcoinTestFramework):
|
|||
assert_equal(address_assert['ismine'], False)
|
||||
assert_equal(address_assert['timestamp'], timestamp)
|
||||
|
||||
|
||||
# ScriptPubKey + Public key + internal
|
||||
self.log.info("Should import a scriptPubKey with internal and with public key")
|
||||
address = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
|
@ -257,7 +254,6 @@ class ImportMultiTest(BitcoinTestFramework):
|
|||
assert_equal(address_assert['ismine'], False)
|
||||
assert_equal('timestamp' in address_assert, False)
|
||||
|
||||
|
||||
# P2SH address
|
||||
sig_address_1 = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
sig_address_2 = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
|
@ -284,7 +280,6 @@ class ImportMultiTest(BitcoinTestFramework):
|
|||
assert_equal(p2shunspent['spendable'], False)
|
||||
assert_equal(p2shunspent['solvable'], False)
|
||||
|
||||
|
||||
# P2SH + Redeem script
|
||||
sig_address_1 = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
sig_address_2 = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
|
@ -311,7 +306,6 @@ class ImportMultiTest(BitcoinTestFramework):
|
|||
assert_equal(p2shunspent['spendable'], False)
|
||||
assert_equal(p2shunspent['solvable'], True)
|
||||
|
||||
|
||||
# P2SH + Redeem script + Private Keys + !Watchonly
|
||||
sig_address_1 = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
sig_address_2 = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
|
@ -363,7 +357,6 @@ class ImportMultiTest(BitcoinTestFramework):
|
|||
assert_equal(result[0]['error']['code'], -8)
|
||||
assert_equal(result[0]['error']['message'], 'Watch-only addresses should not include private keys')
|
||||
|
||||
|
||||
# Address + Public key + !Internal + Wrong pubkey
|
||||
self.log.info("Should not import an address with a wrong public key")
|
||||
address = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
|
@ -383,7 +376,6 @@ class ImportMultiTest(BitcoinTestFramework):
|
|||
assert_equal(address_assert['ismine'], False)
|
||||
assert_equal('timestamp' in address_assert, False)
|
||||
|
||||
|
||||
# ScriptPubKey + Public key + internal + Wrong pubkey
|
||||
self.log.info("Should not import a scriptPubKey with internal and with a wrong public key")
|
||||
address = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
|
@ -403,7 +395,6 @@ class ImportMultiTest(BitcoinTestFramework):
|
|||
assert_equal(address_assert['ismine'], False)
|
||||
assert_equal('timestamp' in address_assert, False)
|
||||
|
||||
|
||||
# Address + Private key + !watchonly + Wrong private key
|
||||
self.log.info("Should not import an address with a wrong private key")
|
||||
address = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
|
@ -423,7 +414,6 @@ class ImportMultiTest(BitcoinTestFramework):
|
|||
assert_equal(address_assert['ismine'], False)
|
||||
assert_equal('timestamp' in address_assert, False)
|
||||
|
||||
|
||||
# ScriptPubKey + Private key + internal + Wrong private key
|
||||
self.log.info("Should not import a scriptPubKey with internal and with a wrong private key")
|
||||
address = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
|
||||
|
@ -442,7 +432,6 @@ class ImportMultiTest(BitcoinTestFramework):
|
|||
assert_equal(address_assert['ismine'], False)
|
||||
assert_equal('timestamp' in address_assert, False)
|
||||
|
||||
|
||||
# Importing existing watch only address with new timestamp should replace saved timestamp.
|
||||
assert_greater_than(timestamp, watchonly_timestamp)
|
||||
self.log.info("Should replace previously saved watch only timestamp.")
|
||||
|
@ -459,7 +448,6 @@ class ImportMultiTest(BitcoinTestFramework):
|
|||
assert_equal(address_assert['timestamp'], timestamp)
|
||||
watchonly_timestamp = timestamp
|
||||
|
||||
|
||||
# restart nodes to check for proper serialization/deserialization of watch only address
|
||||
self.stop_nodes()
|
||||
self.start_nodes()
|
||||
|
@ -471,13 +459,11 @@ class ImportMultiTest(BitcoinTestFramework):
|
|||
# Bad or missing timestamps
|
||||
self.log.info("Should throw on invalid or missing timestamp values")
|
||||
assert_raises_rpc_error(-3, 'Missing required timestamp field for key',
|
||||
self.nodes[1].importmulti, [{
|
||||
"scriptPubKey": address['scriptPubKey'],
|
||||
}])
|
||||
self.nodes[1].importmulti, [{"scriptPubKey": address['scriptPubKey']}])
|
||||
assert_raises_rpc_error(-3, 'Expected number or "now" timestamp value for key. got type string',
|
||||
self.nodes[1].importmulti, [{
|
||||
"scriptPubKey": address['scriptPubKey'],
|
||||
"timestamp": "",
|
||||
"timestamp": ""
|
||||
}])
|
||||
|
||||
# Import P2WPKH address as watch only
|
||||
|
|
Loading…
Reference in a new issue