mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-04-25 08:40:12 +00:00
Ignore commented lines when reding PRIVACYLEVEL from config file
Create dedicated getVal function in utils.sh as it might be useful somewhere else Account for tailing comments and $key not being on the first line Signed-off-by: Christian König <ckoenig@posteo.de>
This commit is contained in:
parent
45cab12392
commit
4fd0f15d90
3 changed files with 38 additions and 3 deletions
|
@ -62,6 +62,22 @@ def test_key_removal_works(host):
|
|||
assert expected_stdout == output.stdout
|
||||
|
||||
|
||||
def test_get_value_works(host):
|
||||
"""Confirms getVal returns the correct value for a given key"""
|
||||
output = host.run(
|
||||
"""
|
||||
source /opt/pihole/utils.sh
|
||||
echo "Somekey=xxx" >> /tmp/testfile
|
||||
echo "#Testkey=1234" >> /tmp/testfile
|
||||
echo "Testkey=5678" >> /tmp/testfile
|
||||
echo "Testkey=abcd" >> /tmp/testfile
|
||||
getVal "/tmp/testfile" "Testkey"
|
||||
"""
|
||||
)
|
||||
expected_stdout = "5678"
|
||||
assert expected_stdout == output.stdout
|
||||
|
||||
|
||||
def test_getFTLAPIPort_default(host):
|
||||
"""Confirms getFTLAPIPort returns the default API port"""
|
||||
output = host.run(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue