Skip to content

Commit 1777644

Browse files
committed
qa, wallet: Verify warning when failing to scan
1 parent 893e51f commit 1777644

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/functional/wallet_multiwallet.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,24 @@ def wallet_file(name):
7878
self.stop_nodes()
7979
assert_equal(os.path.isfile(wallet_dir(self.default_wallet_name, self.wallet_data_filename)), True)
8080

81+
self.log.info("Verify warning is emitted when failing to scan the wallets directory")
82+
if platform.system() == 'Windows':
83+
self.log.warning('Skipping test involving chmod as Windows does not support it.')
84+
elif os.geteuid() == 0:
85+
self.log.warning('Skipping test involving chmod as it requires a non-root user.')
86+
else:
87+
self.start_node(0)
88+
with self.nodes[0].assert_debug_log(unexpected_msgs=['Error scanning directory entries under'], expected_msgs=[]):
89+
result = self.nodes[0].listwalletdir()
90+
assert_equal(result, {'wallets': [{'name': 'default_wallet', 'warnings': []}]})
91+
os.chmod(data_dir('wallets'), 0)
92+
with self.nodes[0].assert_debug_log(expected_msgs=['Error scanning directory entries under']):
93+
result = self.nodes[0].listwalletdir()
94+
assert_equal(result, {'wallets': []})
95+
self.stop_node(0)
96+
# Restore permissions
97+
os.chmod(data_dir('wallets'), stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
98+
8199
# create symlink to verify wallet directory path can be referenced
82100
# through symlink
83101
os.mkdir(wallet_dir('w7'))

0 commit comments

Comments
 (0)