Skip to content

Commit 00d18f8

Browse files
committed
test: add functional tests for -deprecatedrpc=permissive_bool
1 parent 65366a4 commit 00d18f8

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

test/functional/rpc_deprecated.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55
"""Test deprecation of RPC calls."""
66
from test_framework.test_framework import BitcoinTestFramework
7-
# from test_framework.util import assert_raises_rpc_error
7+
from test_framework.util import assert_raises_rpc_error, assert_equal
88

99
class DeprecatedRpcTest(BitcoinTestFramework):
1010
def set_test_params(self):
1111
self.num_nodes = 2
1212
self.setup_clean_chain = True
13-
self.extra_args = [[], []]
13+
self.extra_args = [[], ["-deprecatedrpc=permissive_bool"]]
1414

1515
def run_test(self):
16+
self.test_permissive_bool()
1617
# This test should be used to verify correct behaviour of deprecated
1718
# RPC methods with and without the -deprecatedrpc flags. For example:
1819
#
@@ -25,5 +26,17 @@ def run_test(self):
2526
# self.generate(self.nodes[1], 1)
2627
self.log.info("No tested deprecated RPC methods")
2728

29+
30+
def test_permissive_bool(self):
31+
self.generate(self.nodes[0], 1)
32+
assert_equal([], self.nodes[0].protx("list", "valid", True))
33+
assert_raises_rpc_error(-8, 'detailed must be a JSON boolean. Pass -deprecatedrpc=permissive_bool to allow legacy boolean parsing.', self.nodes[0].protx, "list", "valid", 1)
34+
assert_raises_rpc_error(-8, 'detailed must be a JSON boolean. Pass -deprecatedrpc=permissive_bool to allow legacy boolean parsing.', self.nodes[0].protx, "list", "valid", "1")
35+
36+
assert_equal([], self.nodes[1].protx("list", "valid", True))
37+
assert_equal([], self.nodes[1].protx("list", "valid", 1))
38+
assert_equal([], self.nodes[1].protx("list", "valid", "1"))
39+
40+
2841
if __name__ == '__main__':
2942
DeprecatedRpcTest().main()

0 commit comments

Comments
 (0)