aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorw0xlt <94266259+w0xlt@users.noreply.github.com>2021-12-14 20:10:21 -0300
committerw0xlt <94266259+w0xlt@users.noreply.github.com>2021-12-15 18:41:40 -0300
commitabbb7eccef3fc1c36f34756458d2792f6661e29f (patch)
tree11d952213f1d1d8e63e472ed68d358a598be7fa4 /test
parent4807f73f48f4ff1084fcf7aee94e5b14592bfda8 (diff)
downloadbitcoin-abbb7eccef3fc1c36f34756458d2792f6661e29f.tar.xz
refactor: Move restorewallet() RPC logic to the wallet section
It also simplifies restorewallet() and loadwallet() RPC error handling.
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/wallet_backup.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/test/functional/wallet_backup.py b/test/functional/wallet_backup.py
index 932df4fbff..4bcfc3aa71 100755
--- a/test/functional/wallet_backup.py
+++ b/test/functional/wallet_backup.py
@@ -115,12 +115,16 @@ class WalletBackupTest(BitcoinTestFramework):
nonexistent_wallet_file = os.path.join(self.nodes[0].datadir, 'nonexistent_wallet.bak')
wallet_name = "res0"
assert_raises_rpc_error(-8, "Backup file does not exist", node.restorewallet, wallet_name, nonexistent_wallet_file)
+ not_created_wallet_file = os.path.join(node.datadir, self.chain, 'wallets', wallet_name)
+ assert not os.path.exists(not_created_wallet_file)
def restore_wallet_existent_name(self):
node = self.nodes[3]
- wallet_file = os.path.join(self.nodes[0].datadir, 'wallet.bak')
+ backup_file = os.path.join(self.nodes[0].datadir, 'wallet.bak')
wallet_name = "res0"
- assert_raises_rpc_error(-8, "Wallet name already exists.", node.restorewallet, wallet_name, wallet_file)
+ wallet_file = os.path.join(node.datadir, self.chain, 'wallets', wallet_name)
+ error_message = "Failed to create database path '{}'. Database already exists.".format(wallet_file)
+ assert_raises_rpc_error(-36, error_message, node.restorewallet, wallet_name, backup_file)
def init_three(self):
self.init_wallet(node=0)