mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
Tweak get_directories_recursive
Signed-off-by: Christian König <ckoenig@posteo.de>
This commit is contained in:
parent
d882652a85
commit
d87cad76fb
1 changed files with 4 additions and 10 deletions
|
@ -136,15 +136,9 @@ def test_installPiholeWeb_fresh_install_no_errors(host):
|
||||||
def get_directories_recursive(host, directory):
|
def get_directories_recursive(host, directory):
|
||||||
if directory is None:
|
if directory is None:
|
||||||
return directory
|
return directory
|
||||||
ls = host.run("ls -d {}".format(directory + "/*/"))
|
# returns all non-hidden subdirs of 'directory'
|
||||||
directories = list(filter(bool, ls.stdout.splitlines()))
|
dirs_raw = host.run("find {} -type d -not -path '*/.*'".format(directory))
|
||||||
dirs = directories
|
dirs = list(filter(bool, dirs_raw.stdout.splitlines()))
|
||||||
for dirval in directories:
|
|
||||||
dir_rec = get_directories_recursive(host, dirval)
|
|
||||||
if isinstance(dir_rec, str):
|
|
||||||
dirs.extend([dir_rec])
|
|
||||||
else:
|
|
||||||
dirs.extend(dir_rec)
|
|
||||||
return dirs
|
return dirs
|
||||||
|
|
||||||
|
|
||||||
|
@ -520,7 +514,7 @@ def test_installPihole_fresh_install_readableBlockpage(host, test_webpage):
|
||||||
check_admin = test_cmd.format("x", webroot + "/admin", webuser)
|
check_admin = test_cmd.format("x", webroot + "/admin", webuser)
|
||||||
actual_rc = host.run(check_admin).rc
|
actual_rc = host.run(check_admin).rc
|
||||||
assert exit_status_success == actual_rc
|
assert exit_status_success == actual_rc
|
||||||
directories = get_directories_recursive(host, webroot + "/admin/*/")
|
directories = get_directories_recursive(host, webroot + "/admin/")
|
||||||
for directory in directories:
|
for directory in directories:
|
||||||
check_pihole = test_cmd.format("r", directory, webuser)
|
check_pihole = test_cmd.format("r", directory, webuser)
|
||||||
actual_rc = host.run(check_pihole).rc
|
actual_rc = host.run(check_pihole).rc
|
||||||
|
|
Loading…
Reference in a new issue