mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 10:43:19 -03:00
test: Add functional tests for unloadwallet RPC
This commit is contained in:
parent
6608c369b1
commit
4940a20a46
1 changed files with 21 additions and 0 deletions
|
@ -234,5 +234,26 @@ 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(), [])
|
||||
|
||||
if __name__ == '__main__':
|
||||
MultiWalletTest().main()
|
||||
|
|
Loading…
Add table
Reference in a new issue