aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJon Atack <jon@atack.com>2019-06-27 15:22:17 +0200
committerJon Atack <jon@atack.com>2019-07-08 13:02:23 +0200
commit3bf2b3a37bbd550491d124b77fd7c1b2a7969f66 (patch)
tree2c81d8fe89a68292872c2fc8a6e57788bd1be5c7 /test
parent1eb13f09a9d8c2c7dc69f4cdf1b1ccf632543aa0 (diff)
test: Split tool_wallet.py test into subtests
as per Marco Falke review suggestion.
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/tool_wallet.py20
1 files changed, 18 insertions, 2 deletions
diff --git a/test/functional/tool_wallet.py b/test/functional/tool_wallet.py
index 66d893f57f..e622c75236 100755
--- a/test/functional/tool_wallet.py
+++ b/test/functional/tool_wallet.py
@@ -37,7 +37,7 @@ class ToolWalletTest(BitcoinTestFramework):
assert_equal(stderr, '')
assert_equal(stdout, output)
- def run_test(self):
+ def test_invalid_tool_commands_and_args(self):
self.log.info('Testing that various invalid commands raise with specific error messages')
self.assert_raises_tool_error('Invalid command: foo', 'foo')
# `bitcoin-wallet help` raises an error. Use `bitcoin-wallet -help`.
@@ -47,6 +47,7 @@ class ToolWalletTest(BitcoinTestFramework):
self.assert_raises_tool_error('Error loading wallet.dat. Is wallet being used by other process?', '-wallet=wallet.dat', 'info')
self.assert_raises_tool_error('Error: no wallet file at nonexistent.dat', '-wallet=nonexistent.dat', 'info')
+ def test_tool_wallet_info(self):
# Stop the node to close the wallet to call the info command.
self.stop_node(0)
self.log.info('Calling wallet tool info, testing output')
@@ -61,7 +62,11 @@ class ToolWalletTest(BitcoinTestFramework):
''')
self.assert_tool_output(out, '-wallet=wallet.dat', 'info')
- # Mutate wallet to verify info command output changes accordingly.
+ def test_tool_wallet_info_after_transaction(self):
+ """
+ Mutate the wallet with a transaction to verify that the info command
+ output changes accordingly.
+ """
self.start_node(0)
self.log.info('Generating transaction to mutate wallet')
self.nodes[0].generate(1)
@@ -79,6 +84,7 @@ class ToolWalletTest(BitcoinTestFramework):
''')
self.assert_tool_output(out, '-wallet=wallet.dat', 'info')
+ def test_tool_wallet_create_on_existing_wallet(self):
self.log.info('Calling wallet tool create on an existing wallet, testing output')
out = textwrap.dedent('''\
Topping up keypool...
@@ -92,6 +98,7 @@ class ToolWalletTest(BitcoinTestFramework):
''')
self.assert_tool_output(out, '-wallet=foo', 'create')
+ def test_getwalletinfo_on_different_wallet(self):
self.log.info('Starting node with arg -wallet=foo')
self.start_node(0, ['-wallet=foo'])
@@ -104,5 +111,14 @@ class ToolWalletTest(BitcoinTestFramework):
assert_equal(1000, out['keypoolsize_hd_internal'])
assert_equal(True, 'hdseedid' in out)
+ def run_test(self):
+ self.test_invalid_tool_commands_and_args()
+ # Warning: The following tests are order-dependent.
+ self.test_tool_wallet_info()
+ self.test_tool_wallet_info_after_transaction()
+ self.test_tool_wallet_create_on_existing_wallet()
+ self.test_getwalletinfo_on_different_wallet()
+
+
if __name__ == '__main__':
ToolWalletTest().main()