From a650641da48410744e7bfb77f6d92437a9787282 Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sat, 2 Jul 2022 12:51:03 -0700 Subject: [PATCH] Change tests to mock dialog Signed-off-by: Dan Schaper --- test/test_any_automated_install.py | 18 +++++++++--------- test/test_centos_7_support.py | 8 ++++---- test/test_centos_8_support.py | 8 ++++---- test/test_centos_common_support.py | 8 ++++---- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/test/test_any_automated_install.py b/test/test_any_automated_install.py index f42feef0..61849f54 100644 --- a/test/test_any_automated_install.py +++ b/test/test_any_automated_install.py @@ -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 diff --git a/test/test_centos_7_support.py b/test/test_centos_7_support.py index f72740a6..c7e75813 100644 --- a/test/test_centos_7_support.py +++ b/test/test_centos_7_support.py @@ -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 diff --git a/test/test_centos_8_support.py b/test/test_centos_8_support.py index 464055b4..9adbe841 100644 --- a/test/test_centos_8_support.py +++ b/test/test_centos_8_support.py @@ -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 diff --git a/test/test_centos_common_support.py b/test/test_centos_common_support.py index 80ca2a85..ac408e92 100644 --- a/test/test_centos_common_support.py +++ b/test/test_centos_common_support.py @@ -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