aboutsummaryrefslogtreecommitdiff
path: root/test/functional/wallet_multiwallet.py
diff options
context:
space:
mode:
authorJonas Schnelli <dev@jonasschnelli.ch>2018-06-21 16:24:01 +0200
committerJonas Schnelli <dev@jonasschnelli.ch>2018-06-21 16:24:31 +0200
commit000abbb6b07410357a928768d7d56465ba0d3bac (patch)
tree0cc9241398af02cac96e85876b45ca101cb52656 /test/functional/wallet_multiwallet.py
parent6579d80572d2d33aceabbd3db45a6a9f809aa5e3 (diff)
parentfe65bdec237776dbe094339509dfd2e63329a832 (diff)
downloadbitcoin-000abbb6b07410357a928768d7d56465ba0d3bac.tar.xz
Merge #13111: Add unloadwallet RPC
fe65bdec2 bugfix: Delete walletView in WalletFrame::removeWallet (João Barbosa) 0b82bac76 bugfix: Remove dangling wallet env instance (João Barbosa) 0ee77b207 ui: Support wallets unloaded dynamically (João Barbosa) 9f9b50d5f doc: Add release notes for unloadwallet RPC (João Barbosa) ccbf7ae74 test: Wallet methods are disabled when no wallet is loaded (João Barbosa) 4940a20a4 test: Add functional tests for unloadwallet RPC (João Barbosa) 6608c369b rpc: Add unloadwallet RPC (João Barbosa) 537efe19e rpc: Extract GetWalletNameFromJSONRPCRequest from GetWalletForJSONRPCRequest (João Barbosa) Pull request description: This patch adds wallet unload feature via RPC. It also adds UI support for unloaded wallets. Tree-SHA512: 7c7f9f32f7a2266d2df574aa6b95f993c3dc82736f93304562122beb8756fb28cd22d03866b48f493c747441f22d30e196b098dec435cc25e035633f090351ea
Diffstat (limited to 'test/functional/wallet_multiwallet.py')
-rwxr-xr-xtest/functional/wallet_multiwallet.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/functional/wallet_multiwallet.py b/test/functional/wallet_multiwallet.py
index a0fbc4a754..3cefd83459 100755
--- a/test/functional/wallet_multiwallet.py
+++ b/test/functional/wallet_multiwallet.py
@@ -234,5 +234,32 @@ class MultiWalletTest(BitcoinTestFramework):
assert new_wallet_name in self.nodes[0].listwallets()
+ self.log.info("Test dynamic wallet unloading")
+
+ # Test `unloadwallet` errors
+ assert_raises_rpc_error(-1, "JSON value is not a string as expected", self.nodes[0].unloadwallet)
+ assert_raises_rpc_error(-18, "Requested wallet does not exist or is not loaded", self.nodes[0].unloadwallet, "dummy")
+ assert_raises_rpc_error(-18, "Requested wallet does not exist or is not loaded", node.get_wallet_rpc("dummy").unloadwallet)
+ assert_raises_rpc_error(-8, "Cannot unload the requested wallet", w1.unloadwallet, "w2"),
+
+ # Successfully unload the specified wallet name
+ self.nodes[0].unloadwallet("w1")
+ assert 'w1' not in self.nodes[0].listwallets()
+
+ # Successfully unload the wallet referenced by the request endpoint
+ w2.unloadwallet()
+ assert 'w2' not in self.nodes[0].listwallets()
+
+ # Successfully unload all wallets
+ for wallet_name in self.nodes[0].listwallets():
+ self.nodes[0].unloadwallet(wallet_name)
+ assert_equal(self.nodes[0].listwallets(), [])
+ assert_raises_rpc_error(-32601, "Method not found (wallet method is disabled because no wallet is loaded)", self.nodes[0].getwalletinfo)
+
+ # Successfully load a previously unloaded wallet
+ self.nodes[0].loadwallet('w1')
+ assert_equal(self.nodes[0].listwallets(), ['w1'])
+ assert_equal(w1.getwalletinfo()['walletname'], 'w1')
+
if __name__ == '__main__':
MultiWalletTest().main()