mirror of
https://github.com/pi-hole/pi-hole
synced 2024-12-22 06:48:07 +00:00
Change tests to mock dialog
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
This commit is contained in:
parent
1ed5ff306d
commit
a650641da4
@ -152,8 +152,8 @@ def test_installPihole_fresh_install_readableFiles(host):
|
||||
'''
|
||||
confirms all necessary files are readable by pihole user
|
||||
'''
|
||||
# Whiptail dialog returns Cancel for user prompt
|
||||
mock_command('whiptail', {'*': ('', '0')}, host)
|
||||
# dialog returns Cancel for user prompt
|
||||
mock_command('dialog', {'*': ('', '0')}, host)
|
||||
# mock git pull
|
||||
mock_command_passthrough('git', {'pull': ('', '0')}, host)
|
||||
# mock systemctl to not start lighttpd and FTL
|
||||
@ -393,8 +393,8 @@ def test_installPihole_fresh_install_readableBlockpage(host, test_webpage):
|
||||
"127.0.0.1",
|
||||
# "pi.hole"
|
||||
]
|
||||
# Whiptail dialog returns Cancel for user prompt
|
||||
mock_command('whiptail', {'*': ('', '0')}, host)
|
||||
# dialog returns Cancel for user prompt
|
||||
mock_command('dialog', {'*': ('', '0')}, host)
|
||||
|
||||
# mock git pull
|
||||
mock_command_passthrough('git', {'pull': ('', '0')}, host)
|
||||
@ -870,8 +870,8 @@ def test_FTL_download_aarch64_no_errors(host):
|
||||
'''
|
||||
confirms only aarch64 package is downloaded for FTL engine
|
||||
'''
|
||||
# mock whiptail answers and ensure installer dependencies
|
||||
mock_command('whiptail', {'*': ('', '0')}, host)
|
||||
# mock dialog answers and ensure installer dependencies
|
||||
mock_command('dialog', {'*': ('', '0')}, host)
|
||||
host.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
package_manager_detect
|
||||
@ -1100,7 +1100,7 @@ def test_os_check_passes(host):
|
||||
|
||||
def test_package_manager_has_installer_deps(host):
|
||||
''' Confirms OS is able to install the required packages for the installer'''
|
||||
mock_command('whiptail', {'*': ('', '0')}, host)
|
||||
mock_command('dialog', {'*': ('', '0')}, host)
|
||||
output = host.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
package_manager_detect
|
||||
@ -1113,7 +1113,7 @@ def test_package_manager_has_installer_deps(host):
|
||||
|
||||
def test_package_manager_has_pihole_deps(host):
|
||||
''' Confirms OS is able to install the required packages for Pi-hole '''
|
||||
mock_command('whiptail', {'*': ('', '0')}, host)
|
||||
mock_command('dialog', {'*': ('', '0')}, host)
|
||||
output = host.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
package_manager_detect
|
||||
@ -1127,7 +1127,7 @@ def test_package_manager_has_pihole_deps(host):
|
||||
|
||||
def test_package_manager_has_web_deps(host):
|
||||
''' Confirms OS is able to install the required packages for web '''
|
||||
mock_command('whiptail', {'*': ('', '0')}, host)
|
||||
mock_command('dialog', {'*': ('', '0')}, host)
|
||||
output = host.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
package_manager_detect
|
||||
|
@ -26,8 +26,8 @@ def test_php_upgrade_user_optout_centos_eq_7(host):
|
||||
confirms installer behavior when user opt-out of installing PHP7 from REMI
|
||||
(php not currently installed)
|
||||
'''
|
||||
# Whiptail dialog returns Cancel for user prompt
|
||||
mock_command('whiptail', {'*': ('', '1')}, host)
|
||||
# dialog returns Cancel for user prompt
|
||||
mock_command('dialog', {'*': ('', '1')}, host)
|
||||
package_manager_detect = host.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
package_manager_detect
|
||||
@ -45,8 +45,8 @@ def test_php_upgrade_user_optin_centos_eq_7(host):
|
||||
confirms installer behavior when user opt-in to installing PHP7 from REMI
|
||||
(php not currently installed)
|
||||
'''
|
||||
# Whiptail dialog returns Continue for user prompt
|
||||
mock_command('whiptail', {'*': ('', '0')}, host)
|
||||
# dialog returns Continue for user prompt
|
||||
mock_command('dialog', {'*': ('', '0')}, host)
|
||||
package_manager_detect = host.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
package_manager_detect
|
||||
|
@ -29,8 +29,8 @@ def test_php_upgrade_user_optout_skipped_centos_gte_8(host):
|
||||
latest CentOS (should trigger on CentOS7 only)
|
||||
(php not currently installed)
|
||||
'''
|
||||
# Whiptail dialog returns Cancel for user prompt
|
||||
mock_command('whiptail', {'*': ('', '1')}, host)
|
||||
# dialog dialog returns Cancel for user prompt
|
||||
mock_command('dialog', {'*': ('', '1')}, host)
|
||||
package_manager_detect = host.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
package_manager_detect
|
||||
@ -50,8 +50,8 @@ def test_php_upgrade_user_optin_skipped_centos_gte_8(host):
|
||||
latest CentOS (should trigger on CentOS7 only)
|
||||
(php not currently installed)
|
||||
'''
|
||||
# Whiptail dialog returns Continue for user prompt
|
||||
mock_command('whiptail', {'*': ('', '0')}, host)
|
||||
# dialog dialog returns Continue for user prompt
|
||||
mock_command('dialog', {'*': ('', '0')}, host)
|
||||
package_manager_detect = host.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
package_manager_detect
|
||||
|
@ -76,8 +76,8 @@ def test_php_version_lt_7_detected_upgrade_user_optout_centos(host):
|
||||
default_centos_php_version = php_package.version.split('.')[0]
|
||||
if int(default_centos_php_version) >= 7: # PHP7 is supported/recommended
|
||||
pytest.skip("Test deprecated . Detected default PHP version >= 7")
|
||||
# Whiptail dialog returns Cancel for user prompt
|
||||
mock_command('whiptail', {'*': ('', '1')}, host)
|
||||
# dialog returns Cancel for user prompt
|
||||
mock_command('dialog', {'*': ('', '1')}, host)
|
||||
package_manager_detect = host.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
package_manager_detect
|
||||
@ -101,8 +101,8 @@ def test_php_version_lt_7_detected_upgrade_user_optin_centos(host):
|
||||
default_centos_php_version = php_package.version.split('.')[0]
|
||||
if int(default_centos_php_version) >= 7: # PHP7 is supported/recommended
|
||||
pytest.skip("Test deprecated . Detected default PHP version >= 7")
|
||||
# Whiptail dialog returns Continue for user prompt
|
||||
mock_command('whiptail', {'*': ('', '0')}, host)
|
||||
# dialog returns Continue for user prompt
|
||||
mock_command('dialog', {'*': ('', '0')}, host)
|
||||
package_manager_detect = host.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
package_manager_detect
|
||||
|
Loading…
Reference in New Issue
Block a user