aboutsummaryrefslogtreecommitdiff
path: root/test/functional/tool_wallet.py
diff options
context:
space:
mode:
authorJon Atack <jon@atack.com>2019-03-27 16:34:39 +0100
committerJon Atack <jon@atack.com>2019-07-08 12:33:41 +0200
commit1eb13f09a9d8c2c7dc69f4cdf1b1ccf632543aa0 (patch)
tree099aed1a43721a7cc4b428ee6ea19b45f92e7edd /test/functional/tool_wallet.py
parent04710b6d8c9e286485f4241671df72216b0f4698 (diff)
test: Add log messages to test/functional/tool_wallet.py
and update code comments as per Python PEP 8 style guide.
Diffstat (limited to 'test/functional/tool_wallet.py')
-rwxr-xr-xtest/functional/tool_wallet.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/test/functional/tool_wallet.py b/test/functional/tool_wallet.py
index fbcf21e729..66d893f57f 100755
--- a/test/functional/tool_wallet.py
+++ b/test/functional/tool_wallet.py
@@ -1,8 +1,9 @@
#!/usr/bin/env python3
-# Copyright (c) 2018 The Bitcoin Core developers
+# Copyright (c) 2018-2019 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 bitcoin-wallet."""
+
import subprocess
import textwrap
@@ -37,18 +38,18 @@ class ToolWalletTest(BitcoinTestFramework):
assert_equal(stdout, output)
def run_test(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` is an error. Use `bitcoin-wallet -help`
+ # `bitcoin-wallet help` raises an error. Use `bitcoin-wallet -help`.
self.assert_raises_tool_error('Invalid command: help', 'help')
self.assert_raises_tool_error('Error: two methods provided (info and create). Only one method should be provided.', 'info', 'create')
self.assert_raises_tool_error('Error parsing command line arguments: Invalid parameter -foo', '-foo')
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')
- # stop the node to close the wallet to call info command
+ # 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')
out = textwrap.dedent('''\
Wallet info
===========
@@ -60,11 +61,13 @@ class ToolWalletTest(BitcoinTestFramework):
''')
self.assert_tool_output(out, '-wallet=wallet.dat', 'info')
- # mutate the wallet to check the info command output changes accordingly
+ # Mutate wallet to verify info command output changes accordingly.
self.start_node(0)
+ self.log.info('Generating transaction to mutate wallet')
self.nodes[0].generate(1)
self.stop_node(0)
+ self.log.info('Calling wallet tool info after generating a transaction, testing output')
out = textwrap.dedent('''\
Wallet info
===========
@@ -76,6 +79,7 @@ class ToolWalletTest(BitcoinTestFramework):
''')
self.assert_tool_output(out, '-wallet=wallet.dat', 'info')
+ self.log.info('Calling wallet tool create on an existing wallet, testing output')
out = textwrap.dedent('''\
Topping up keypool...
Wallet info
@@ -88,7 +92,10 @@ class ToolWalletTest(BitcoinTestFramework):
''')
self.assert_tool_output(out, '-wallet=foo', 'create')
+ self.log.info('Starting node with arg -wallet=foo')
self.start_node(0, ['-wallet=foo'])
+
+ self.log.info('Calling getwalletinfo on a different wallet ("foo"), testing output')
out = self.nodes[0].getwalletinfo()
self.stop_node(0)