Fresh install web page directory tests

This commit is contained in:
Dan Schaper 2017-01-27 20:24:20 -08:00
parent cc7c48237c
commit 5b43f13935
No known key found for this signature in database
GPG key ID: 572E999E385B7BFC
2 changed files with 15 additions and 1 deletions

View file

@ -809,7 +809,7 @@ installPiholeWeb() {
if [ -f "/var/www/html/pihole/blockingpage.css" ]; then if [ -f "/var/www/html/pihole/blockingpage.css" ]; then
echo "::: Existing blockingpage.css detected, not overwriting" echo "::: Existing blockingpage.css detected, not overwriting"
else else
echo -n "::: index.css missing, replacing... " echo -n "::: blockingpage.css missing, replacing... "
cp /etc/.pihole/advanced/blockingpage.css /var/www/html/pihole cp /etc/.pihole/advanced/blockingpage.css /var/www/html/pihole
echo " done!" echo " done!"
fi fi

View file

@ -167,6 +167,20 @@ def test_configureFirewall_IPTables_enabled_not_exist_no_errors(Pihole):
assert 'iptables -I INPUT 1 -p tcp -m tcp --dport 53 -j ACCEPT' in firewall_calls assert 'iptables -I INPUT 1 -p tcp -m tcp --dport 53 -j ACCEPT' in firewall_calls
assert 'iptables -I INPUT 1 -p udp -m udp --dport 53 -j ACCEPT' in firewall_calls assert 'iptables -I INPUT 1 -p udp -m udp --dport 53 -j ACCEPT' in firewall_calls
def test_installPiholeWeb_fresh_install_no_errors(Pihole):
''' confirms all web page assets from Core repo are installed on a fresh build '''
installWeb = Pihole.run('''
source /opt/pihole/basic-install.sh
installPiholeWeb
''')
assert 'Installing pihole custom index page...' in installWeb.stdout
assert 'No default index.lighttpd.html file found... not backing up' in installWeb.stdout
web_directory = Pihole.run('ls -r /var/www/html/pihole').stdout
assert 'index.php' in web_directory
assert 'index.js' in web_directory
assert 'blockingpage.css' in web_directory
# Helper functions # Helper functions
def mock_command(script, args, container): def mock_command(script, args, container):
''' Allows for setup of commands we don't really want to have to run for real in unit tests ''' ''' Allows for setup of commands we don't really want to have to run for real in unit tests '''