mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-04-19 05:40:13 +00:00
Split new function out into a separte utility script and add a test for it. Can be used in future to organise re/commonly-used code
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
parent
1dd9d55d82
commit
77e5121d43
15 changed files with 69 additions and 25 deletions
16
test/test_any_utils.py
Normal file
16
test/test_any_utils.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
def test_key_val_replacement_works(host):
|
||||
''' Confirms addOrEditKeyValPair provides the expected output '''
|
||||
host.run('''
|
||||
setupvars=./testoutput
|
||||
source /opt/pihole/utils.sh
|
||||
addOrEditKeyValPair "KEY_ONE" "value1" "./testoutput"
|
||||
addOrEditKeyValPair "KEY_TWO" "value2" "./testoutput"
|
||||
addOrEditKeyValPair "KEY_ONE" "value3" "./testoutput"
|
||||
addOrEditKeyValPair "KEY_FOUR" "value4" "./testoutput"
|
||||
cat ./testoutput
|
||||
''')
|
||||
output = host.run('''
|
||||
cat ./testoutput
|
||||
''')
|
||||
expected_stdout = 'KEY_ONE=value3\nKEY_TWO=value2\nKEY_FOUR=value4\n'
|
||||
assert expected_stdout == output.stdout
|
Loading…
Add table
Add a link
Reference in a new issue