aboutsummaryrefslogtreecommitdiff
path: root/test/functional/rpc_getaddressinfo_label_deprecation.py
diff options
context:
space:
mode:
authorJon Atack <jon@atack.com>2019-11-25 02:04:14 +0100
committerJon Atack <jon@atack.com>2020-01-09 18:08:24 +0100
commit72af93f36479dc12d795f1d05fa3d8fbd9b293bd (patch)
treeaaafbe30b028e1622c74c54d8ea0d576b5feaee0 /test/functional/rpc_getaddressinfo_label_deprecation.py
parentd48875fa20d0b71b978cb3d1f85dd9ec14e664cc (diff)
test: getaddressinfo label deprecation test
Diffstat (limited to 'test/functional/rpc_getaddressinfo_label_deprecation.py')
-rwxr-xr-xtest/functional/rpc_getaddressinfo_label_deprecation.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/test/functional/rpc_getaddressinfo_label_deprecation.py b/test/functional/rpc_getaddressinfo_label_deprecation.py
new file mode 100755
index 0000000000..5e739ebede
--- /dev/null
+++ b/test/functional/rpc_getaddressinfo_label_deprecation.py
@@ -0,0 +1,43 @@
+#!/usr/bin/env python3
+# Copyright (c) 2020 The Bitcoin Core developers
+# Distributed under the MIT software license, see the accompanying
+# file COPYING or http://www.opensource.org/licenses/mit-license.php.
+"""
+Test deprecation of the RPC getaddressinfo `label` field. It has been
+superceded by the `labels` field.
+
+"""
+from test_framework.test_framework import BitcoinTestFramework
+
+class GetAddressInfoLabelDeprecationTest(BitcoinTestFramework):
+ def set_test_params(self):
+ self.num_nodes = 2
+ self.setup_clean_chain = False
+ # Start node[0] with -deprecatedrpc=label, and node[1] without.
+ self.extra_args = [["-deprecatedrpc=label"], []]
+
+ def skip_test_if_missing_module(self):
+ self.skip_if_no_wallet()
+
+ def test_label_with_deprecatedrpc_flag(self):
+ self.log.info("Test getaddressinfo label with -deprecatedrpc flag")
+ node = self.nodes[0]
+ address = node.getnewaddress()
+ info = node.getaddressinfo(address)
+ assert "label" in info
+
+ def test_label_without_deprecatedrpc_flag(self):
+ self.log.info("Test getaddressinfo label without -deprecatedrpc flag")
+ node = self.nodes[1]
+ address = node.getnewaddress()
+ info = node.getaddressinfo(address)
+ assert "label" not in info
+
+ def run_test(self):
+ """Test getaddressinfo label with and without -deprecatedrpc flag."""
+ self.test_label_with_deprecatedrpc_flag()
+ self.test_label_without_deprecatedrpc_flag()
+
+
+if __name__ == '__main__':
+ GetAddressInfoLabelDeprecationTest().main()