@@ -37,7 +37,7 @@ def assert_tool_output(self, output, *args):
37
37
assert_equal (stderr , '' )
38
38
assert_equal (stdout , output )
39
39
40
- def run_test (self ):
40
+ def test_invalid_tool_commands_and_args (self ):
41
41
self .log .info ('Testing that various invalid commands raise with specific error messages' )
42
42
self .assert_raises_tool_error ('Invalid command: foo' , 'foo' )
43
43
# `bitcoin-wallet help` raises an error. Use `bitcoin-wallet -help`.
@@ -47,6 +47,7 @@ def run_test(self):
47
47
self .assert_raises_tool_error ('Error loading wallet.dat. Is wallet being used by other process?' , '-wallet=wallet.dat' , 'info' )
48
48
self .assert_raises_tool_error ('Error: no wallet file at nonexistent.dat' , '-wallet=nonexistent.dat' , 'info' )
49
49
50
+ def test_tool_wallet_info (self ):
50
51
# Stop the node to close the wallet to call the info command.
51
52
self .stop_node (0 )
52
53
self .log .info ('Calling wallet tool info, testing output' )
@@ -61,7 +62,11 @@ def run_test(self):
61
62
''' )
62
63
self .assert_tool_output (out , '-wallet=wallet.dat' , 'info' )
63
64
64
- # Mutate wallet to verify info command output changes accordingly.
65
+ def test_tool_wallet_info_after_transaction (self ):
66
+ """
67
+ Mutate the wallet with a transaction to verify that the info command
68
+ output changes accordingly.
69
+ """
65
70
self .start_node (0 )
66
71
self .log .info ('Generating transaction to mutate wallet' )
67
72
self .nodes [0 ].generate (1 )
@@ -79,6 +84,7 @@ def run_test(self):
79
84
''' )
80
85
self .assert_tool_output (out , '-wallet=wallet.dat' , 'info' )
81
86
87
+ def test_tool_wallet_create_on_existing_wallet (self ):
82
88
self .log .info ('Calling wallet tool create on an existing wallet, testing output' )
83
89
out = textwrap .dedent ('''\
84
90
Topping up keypool...
@@ -92,6 +98,7 @@ def run_test(self):
92
98
''' )
93
99
self .assert_tool_output (out , '-wallet=foo' , 'create' )
94
100
101
+ def test_getwalletinfo_on_different_wallet (self ):
95
102
self .log .info ('Starting node with arg -wallet=foo' )
96
103
self .start_node (0 , ['-wallet=foo' ])
97
104
@@ -104,5 +111,14 @@ def run_test(self):
104
111
assert_equal (1000 , out ['keypoolsize_hd_internal' ])
105
112
assert_equal (True , 'hdseedid' in out )
106
113
114
+ def run_test (self ):
115
+ self .test_invalid_tool_commands_and_args ()
116
+ # Warning: The following tests are order-dependent.
117
+ self .test_tool_wallet_info ()
118
+ self .test_tool_wallet_info_after_transaction ()
119
+ self .test_tool_wallet_create_on_existing_wallet ()
120
+ self .test_getwalletinfo_on_different_wallet ()
121
+
122
+
107
123
if __name__ == '__main__' :
108
124
ToolWalletTest ().main ()
0 commit comments