mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-04-27 01:30:18 +00:00
add wrappers to utils.sh for setting FTL config & add tests
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
parent
e3ffec5762
commit
632aead691
2 changed files with 78 additions and 0 deletions
|
@ -170,3 +170,58 @@ def test_getFTLPIDFile_and_getFTLPID_custom(host):
|
|||
)
|
||||
expected_stdout = "1234\n"
|
||||
assert expected_stdout == output.stdout
|
||||
|
||||
|
||||
def test_setFTLConfigValue_getFTLConfigValue(host):
|
||||
"""
|
||||
Confirms setFTLConfigValue works
|
||||
Requires FTL to be installed, so we do that first (taken from test_FTL_binary_installed_and_responsive_no_errors)
|
||||
"""
|
||||
host.run(
|
||||
"""
|
||||
source /opt/pihole/basic-install.sh
|
||||
create_pihole_user
|
||||
funcOutput=$(get_binary_name)
|
||||
echo "new/http" > /etc/pihole/ftlbranch
|
||||
binary="pihole-FTL${funcOutput##*pihole-FTL}"
|
||||
theRest="${funcOutput%pihole-FTL*}"
|
||||
FTLdetect "${binary}" "${theRest}"
|
||||
"""
|
||||
)
|
||||
|
||||
output = host.run(
|
||||
"""
|
||||
source /opt/pihole/utils.sh
|
||||
setFTLConfigValue "dnsmasq.upstreams" '["1.1.1.1"]'
|
||||
"""
|
||||
)
|
||||
|
||||
assert '[ "1.1.1.1" ]' in output.stdout
|
||||
|
||||
|
||||
def test_getFTLConfigValue_getFTLConfigValue(host):
|
||||
"""
|
||||
Confirms getFTLConfigValue works (also assumes setFTLConfigValue works)
|
||||
Requires FTL to be installed, so we do that first (taken from test_FTL_binary_installed_and_responsive_no_errors)
|
||||
"""
|
||||
host.run(
|
||||
"""
|
||||
source /opt/pihole/basic-install.sh
|
||||
create_pihole_user
|
||||
funcOutput=$(get_binary_name)
|
||||
echo "new/http" > /etc/pihole/ftlbranch
|
||||
binary="pihole-FTL${funcOutput##*pihole-FTL}"
|
||||
theRest="${funcOutput%pihole-FTL*}"
|
||||
FTLdetect "${binary}" "${theRest}"
|
||||
"""
|
||||
)
|
||||
|
||||
output = host.run(
|
||||
"""
|
||||
source /opt/pihole/utils.sh
|
||||
setFTLConfigValue "dnsmasq.upstreams" '["9.9.9.9"]' > /dev/null
|
||||
getFTLConfigValue "dnsmasq.upstreams"
|
||||
"""
|
||||
)
|
||||
|
||||
assert '[ "9.9.9.9" ]' in output.stdout
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue