Skip to content

Commit bbbbb3f

Browse files
author
MarcoFalke
committed
qa: Add test to ensure node can generate all help texts at runtime
1 parent 73a8408 commit bbbbb3f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/functional/rpc_help.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,18 @@
77
from test_framework.test_framework import BitcoinTestFramework
88
from test_framework.util import assert_equal, assert_raises_rpc_error
99

10+
import os
11+
1012

1113
class HelpRpcTest(BitcoinTestFramework):
1214
def set_test_params(self):
1315
self.num_nodes = 1
1416

1517
def run_test(self):
18+
self.test_categories()
19+
self.dump_help()
20+
21+
def test_categories(self):
1622
node = self.nodes[0]
1723

1824
# wrong argument count
@@ -37,6 +43,15 @@ def run_test(self):
3743

3844
assert_equal(titles, components)
3945

46+
def dump_help(self):
47+
dump_dir = os.path.join(self.options.tmpdir, 'rpc_help_dump')
48+
os.mkdir(dump_dir)
49+
calls = [line.split(' ', 1)[0] for line in self.nodes[0].help().splitlines() if line and not line.startswith('==')]
50+
for call in calls:
51+
with open(os.path.join(dump_dir, call), 'w', encoding='utf-8') as f:
52+
# Make sure the node can generate the help at runtime without crashing
53+
f.write(self.nodes[0].help(call))
54+
4055

4156
if __name__ == '__main__':
4257
HelpRpcTest().main()

0 commit comments

Comments
 (0)