aboutsummaryrefslogtreecommitdiff
path: root/test/functional/interface_bitcoin_cli.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/interface_bitcoin_cli.py')
-rwxr-xr-xtest/functional/interface_bitcoin_cli.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/test/functional/interface_bitcoin_cli.py b/test/functional/interface_bitcoin_cli.py
index a6628dcbf3..7194c8ece4 100755
--- a/test/functional/interface_bitcoin_cli.py
+++ b/test/functional/interface_bitcoin_cli.py
@@ -30,7 +30,12 @@ JSON_PARSING_ERROR = 'error: Error parsing JSON: foo'
BLOCKS_VALUE_OF_ZERO = 'error: the first argument (number of blocks to generate, default: 1) must be an integer value greater than zero'
TOO_MANY_ARGS = 'error: too many arguments (maximum 2 for nblocks and maxtries)'
WALLET_NOT_LOADED = 'Requested wallet does not exist or is not loaded'
-WALLET_NOT_SPECIFIED = 'Wallet file not specified'
+WALLET_NOT_SPECIFIED = (
+ "Multiple wallets are loaded. Please select which wallet to use by requesting the RPC "
+ "through the /wallet/<walletname> URI path. Or for the CLI, specify the \"-rpcwallet=<walletname>\" "
+ "option before the command (run \"bitcoin-cli -h\" for help or \"bitcoin-cli listwallets\" to see "
+ "which wallets are currently loaded)."
+)
def cli_get_info_string_to_dict(cli_get_info_string):
@@ -331,6 +336,10 @@ class TestBitcoinCli(BitcoinTestFramework):
n4 = 10
blocks = self.nodes[0].getblockcount()
+ self.log.info('Test -generate -rpcwallet=<filename> raise RPC error')
+ wallet2_path = f'-rpcwallet={self.nodes[0].wallets_path / wallets[2] / self.wallet_data_filename}'
+ assert_raises_rpc_error(-18, WALLET_NOT_LOADED, self.nodes[0].cli(wallet2_path, '-generate').echo)
+
self.log.info('Test -generate -rpcwallet with no args')
generate = self.nodes[0].cli(rpcwallet2, '-generate').send_cli()
assert_equal(set(generate.keys()), {'address', 'blocks'})
@@ -381,6 +390,9 @@ class TestBitcoinCli(BitcoinTestFramework):
assert_raises_process_error(1, "Could not connect to the server", self.nodes[0].cli('-rpcwait', '-rpcwaittimeout=5').echo)
assert_greater_than_or_equal(time.time(), start_time + 5)
+ self.log.info("Test that only one of -addrinfo, -generate, -getinfo, -netinfo may be specified at a time")
+ assert_raises_process_error(1, "Only one of -getinfo, -netinfo may be specified", self.nodes[0].cli('-getinfo', '-netinfo').send_cli)
+
if __name__ == '__main__':
- TestBitcoinCli().main()
+ TestBitcoinCli(__file__).main()