1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-12-22 23:08:07 +00:00

Add tests

Signed-off-by: Christian König <ckoenig@posteo.de>
This commit is contained in:
Christian König 2022-07-26 16:57:06 +02:00
parent 7b77d991df
commit 2651abbe6c
No known key found for this signature in database
GPG Key ID: 4CDA6F249DD2B485

View File

@ -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