|
|
|
@ -595,80 +595,3 @@ def test_os_check_passes(Pihole):
|
|
|
|
|
''')
|
|
|
|
|
expected_stdout = 'Supported OS detected'
|
|
|
|
|
assert expected_stdout in detectOS.stdout
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_install_dependent_packages_no_errors(Pihole):
|
|
|
|
|
'''
|
|
|
|
|
confirms all dependent packages are installed on a fresh build
|
|
|
|
|
'''
|
|
|
|
|
# mock whiptail answers to use universe repo if asked
|
|
|
|
|
mock_command('whiptail', {'*': ('', '1')}, Pihole)
|
|
|
|
|
# create configuration file
|
|
|
|
|
setup_var_file = 'cat <<EOF> /etc/pihole/setupVars.conf\n'
|
|
|
|
|
for k, v in SETUPVARS.items():
|
|
|
|
|
setup_var_file += "{}={}\n".format(k, v)
|
|
|
|
|
setup_var_file += "EOF\n"
|
|
|
|
|
Pihole.run(setup_var_file)
|
|
|
|
|
install = Pihole.run('''
|
|
|
|
|
runUnattended=true
|
|
|
|
|
useUpdateVars=true
|
|
|
|
|
source /opt/pihole/basic-install.sh
|
|
|
|
|
runUnattended=true
|
|
|
|
|
useUpdateVars=true
|
|
|
|
|
distro_check
|
|
|
|
|
update_package_cache || exit 1
|
|
|
|
|
install_dependent_packages "${INSTALLER_DEPS[@]}"
|
|
|
|
|
''')
|
|
|
|
|
|
|
|
|
|
assert install.rc == 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_install_dependent_packages_web_no_errors(Pihole):
|
|
|
|
|
'''
|
|
|
|
|
confirms all dependent web packages are installed on a fresh build
|
|
|
|
|
'''
|
|
|
|
|
# mock whiptail answers to use universe repo if asked
|
|
|
|
|
mock_command('whiptail', {'*': ('', '1')}, Pihole)
|
|
|
|
|
# mock systemctl to start lighttpd
|
|
|
|
|
mock_command_2(
|
|
|
|
|
'systemctl',
|
|
|
|
|
{
|
|
|
|
|
'enable lighttpd': (
|
|
|
|
|
'',
|
|
|
|
|
'0'
|
|
|
|
|
),
|
|
|
|
|
'restart lighttpd': (
|
|
|
|
|
'/etc/init.d/lighttpd restart',
|
|
|
|
|
'0'
|
|
|
|
|
),
|
|
|
|
|
'start lighttpd': (
|
|
|
|
|
'/etc/init.d/lighttpd start',
|
|
|
|
|
'0'
|
|
|
|
|
)
|
|
|
|
|
},
|
|
|
|
|
Pihole
|
|
|
|
|
)
|
|
|
|
|
# create configuration file
|
|
|
|
|
setup_var_file = 'cat <<EOF> /etc/pihole/setupVars.conf\n'
|
|
|
|
|
for k, v in SETUPVARS.items():
|
|
|
|
|
setup_var_file += "{}={}\n".format(k, v)
|
|
|
|
|
setup_var_file += "EOF\n"
|
|
|
|
|
Pihole.run(setup_var_file)
|
|
|
|
|
install = Pihole.run('''
|
|
|
|
|
runUnattended=true
|
|
|
|
|
useUpdateVars=true
|
|
|
|
|
INSTALL_WEB_SERVER=true
|
|
|
|
|
source /opt/pihole/basic-install.sh
|
|
|
|
|
runUnattended=true
|
|
|
|
|
useUpdateVars=true
|
|
|
|
|
INSTALL_WEB_SERVER=true
|
|
|
|
|
distro_check
|
|
|
|
|
update_package_cache || exit 1
|
|
|
|
|
dep_install_list=("${PIHOLE_DEPS[@]}")
|
|
|
|
|
if [[ "${INSTALL_WEB_SERVER}" == true ]]; then
|
|
|
|
|
dep_install_list+=("${PIHOLE_WEB_DEPS[@]}")
|
|
|
|
|
fi
|
|
|
|
|
install_dependent_packages "${dep_install_list[@]}"
|
|
|
|
|
''')
|
|
|
|
|
|
|
|
|
|
assert install.rc == 0
|
|
|
|
|