Skip to content

Commit

Permalink
qa: Add tests for listwalletdir RPC
Browse files Browse the repository at this point in the history
  • Loading branch information
promag committed Oct 18, 2018
1 parent cc33773 commit 0cb3cad
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/functional/wallet_multiwallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ def wallet_file(name):
return wallet_dir(name, "wallet.dat")
return wallet_dir(name)

assert_equal(self.nodes[0].listwalletdir(), { 'wallets': [{ 'name': '' }] })

# check wallet.dat is created
self.stop_nodes()
assert_equal(os.path.isfile(wallet_dir('wallet.dat')), True)
Expand Down Expand Up @@ -68,6 +70,8 @@ def wallet_file(name):
wallet_names = ['w1', 'w2', 'w3', 'w', 'sub/w5', os.path.join(self.options.tmpdir, 'extern/w6'), 'w7_symlink', 'w8', '']
extra_args = ['-wallet={}'.format(n) for n in wallet_names]
self.start_node(0, extra_args)
assert_equal(set(map(lambda w: w['name'], self.nodes[0].listwalletdir()['wallets'])), set(['', 'w3', 'w2', 'sub/w5', 'w7', 'w7', 'w1', 'w8', 'w']))

assert_equal(set(node.listwallets()), set(wallet_names))

# check that all requested wallets were created
Expand Down Expand Up @@ -139,6 +143,8 @@ def wallet_file(name):

self.restart_node(0, extra_args)

assert_equal(set(map(lambda w: w['name'], self.nodes[0].listwalletdir()['wallets'])), set(['', 'w3', 'w2', 'sub/w5', 'w7', 'w7', 'w8_copy', 'w1', 'w8', 'w']))

wallets = [wallet(w) for w in wallet_names]
wallet_bad = wallet("bad")

Expand Down Expand Up @@ -276,6 +282,8 @@ def wallet_file(name):
assert_equal(self.nodes[0].listwallets(), ['w1'])
assert_equal(w1.getwalletinfo()['walletname'], 'w1')

assert_equal(set(map(lambda w: w['name'], self.nodes[0].listwalletdir()['wallets'])), set(['', 'w3', 'w2', 'sub/w5', 'w7', 'w9', 'w7', 'w8_copy', 'w1', 'w8', 'w']))

# Test backing up and restoring wallets
self.log.info("Test wallet backup")
self.restart_node(0, ['-nowallet'])
Expand Down

0 comments on commit 0cb3cad

Please sign in to comment.