mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
Add tests
Signed-off-by: Christian König <ckoenig@posteo.de>
This commit is contained in:
parent
7b77d991df
commit
2651abbe6c
1 changed files with 30 additions and 0 deletions
|
@ -49,6 +49,15 @@ def test_key_removal_works(host):
|
||||||
expected_stdout = 'KEY_ONE=value1\nKEY_THREE=value3\n'
|
expected_stdout = 'KEY_ONE=value1\nKEY_THREE=value3\n'
|
||||||
assert expected_stdout == output.stdout
|
assert expected_stdout == output.stdout
|
||||||
|
|
||||||
|
def test_getFTLAPIPortFile_default(host):
|
||||||
|
''' Confirms getFTLAPIPortFile returns the default API port file path '''
|
||||||
|
output = host.run('''
|
||||||
|
source /opt/pihole/utils.sh
|
||||||
|
getFTLAPIPortFile
|
||||||
|
''')
|
||||||
|
expected_stdout = '/run/pihole-FTL.port\n'
|
||||||
|
assert expected_stdout == output.stdout
|
||||||
|
|
||||||
|
|
||||||
def test_getFTLAPIPort_default(host):
|
def test_getFTLAPIPort_default(host):
|
||||||
''' Confirms getFTLAPIPort returns the default API port '''
|
''' Confirms getFTLAPIPort returns the default API port '''
|
||||||
|
@ -73,3 +82,24 @@ def test_getFTLAPIPortFile_and_getFTLAPIPort_custom(host):
|
||||||
''')
|
''')
|
||||||
expected_stdout = '1234\n'
|
expected_stdout = '1234\n'
|
||||||
assert expected_stdout == output.stdout
|
assert expected_stdout == output.stdout
|
||||||
|
|
||||||
|
def test_getFTLPIDFile_default(host):
|
||||||
|
''' Confirms getFTLPIDFile returns the default PID file path '''
|
||||||
|
output = host.run('''
|
||||||
|
source /opt/pihole/utils.sh
|
||||||
|
getFTLPIDFile
|
||||||
|
''')
|
||||||
|
expected_stdout = '/run/pihole-FTL.pid\n'
|
||||||
|
assert expected_stdout == output.stdout
|
||||||
|
|
||||||
|
def test_getFTLPIDFile_custom(host):
|
||||||
|
''' Confirms getFTLPIDFile returns a custom PID file path '''
|
||||||
|
host.run('''
|
||||||
|
echo "PIDFILE=/tmp/pid.file" > /etc/pihole/pihole-FTL.conf
|
||||||
|
''')
|
||||||
|
output = host.run('''
|
||||||
|
source /opt/pihole/utils.sh
|
||||||
|
getFTLPIDFile
|
||||||
|
''')
|
||||||
|
expected_stdout = '/tmp/pid.file\n'
|
||||||
|
assert expected_stdout == output.stdout
|
||||||
|
|
Loading…
Reference in a new issue