2020-12-01 10:02:31 +00:00
|
|
|
from .conftest import (
|
|
|
|
tick_box,
|
|
|
|
info_box,
|
|
|
|
mock_command,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def test_php_upgrade_default_continue_centos_gte_8(Pihole):
|
|
|
|
'''
|
|
|
|
confirms the latest version of CentOS continues / does not optout
|
|
|
|
(should trigger on CentOS7 only)
|
|
|
|
'''
|
2021-08-03 20:48:26 +00:00
|
|
|
package_manager_detect = Pihole.run('''
|
2020-12-01 10:02:31 +00:00
|
|
|
source /opt/pihole/basic-install.sh
|
2021-08-03 20:48:26 +00:00
|
|
|
package_manager_detect
|
2020-12-01 10:02:31 +00:00
|
|
|
''')
|
|
|
|
unexpected_stdout = info_box + (' User opt-out of PHP 7 upgrade on CentOS.'
|
|
|
|
' Deprecated PHP may be in use.')
|
2021-08-03 20:48:26 +00:00
|
|
|
assert unexpected_stdout not in package_manager_detect.stdout
|
2020-12-01 10:02:31 +00:00
|
|
|
# ensure remi was not installed on latest CentOS
|
|
|
|
remi_package = Pihole.package('remi-release')
|
|
|
|
assert not remi_package.is_installed
|
|
|
|
|
|
|
|
|
|
|
|
def test_php_upgrade_user_optout_skipped_centos_gte_8(Pihole):
|
|
|
|
'''
|
|
|
|
confirms installer skips user opt-out of installing PHP7 from REMI on
|
|
|
|
latest CentOS (should trigger on CentOS7 only)
|
|
|
|
(php not currently installed)
|
|
|
|
'''
|
|
|
|
# Whiptail dialog returns Cancel for user prompt
|
|
|
|
mock_command('whiptail', {'*': ('', '1')}, Pihole)
|
2021-08-03 20:48:26 +00:00
|
|
|
package_manager_detect = Pihole.run('''
|
2020-12-01 10:02:31 +00:00
|
|
|
source /opt/pihole/basic-install.sh
|
2021-08-03 20:48:26 +00:00
|
|
|
package_manager_detect
|
2020-12-01 10:02:31 +00:00
|
|
|
''')
|
|
|
|
unexpected_stdout = info_box + (' User opt-out of PHP 7 upgrade on CentOS.'
|
|
|
|
' Deprecated PHP may be in use.')
|
2021-08-03 20:48:26 +00:00
|
|
|
assert unexpected_stdout not in package_manager_detect.stdout
|
2020-12-01 10:02:31 +00:00
|
|
|
# ensure remi was not installed on latest CentOS
|
|
|
|
remi_package = Pihole.package('remi-release')
|
|
|
|
assert not remi_package.is_installed
|
|
|
|
|
|
|
|
|
|
|
|
def test_php_upgrade_user_optin_skipped_centos_gte_8(Pihole):
|
|
|
|
'''
|
|
|
|
confirms installer skips user opt-in to installing PHP7 from REMI on
|
|
|
|
latest CentOS (should trigger on CentOS7 only)
|
|
|
|
(php not currently installed)
|
|
|
|
'''
|
|
|
|
# Whiptail dialog returns Continue for user prompt
|
|
|
|
mock_command('whiptail', {'*': ('', '0')}, Pihole)
|
2021-08-03 20:48:26 +00:00
|
|
|
package_manager_detect = Pihole.run('''
|
2020-12-01 10:02:31 +00:00
|
|
|
source /opt/pihole/basic-install.sh
|
2021-08-03 20:48:26 +00:00
|
|
|
package_manager_detect
|
2020-12-01 10:02:31 +00:00
|
|
|
''')
|
2021-08-03 20:48:26 +00:00
|
|
|
assert 'opt-out' not in package_manager_detect.stdout
|
2020-12-01 10:02:31 +00:00
|
|
|
unexpected_stdout = info_box + (' Enabling Remi\'s RPM repository '
|
|
|
|
'(https://rpms.remirepo.net)')
|
2021-08-03 20:48:26 +00:00
|
|
|
assert unexpected_stdout not in package_manager_detect.stdout
|
2020-12-01 10:02:31 +00:00
|
|
|
unexpected_stdout = tick_box + (' Remi\'s RPM repository has '
|
|
|
|
'been enabled for PHP7')
|
2021-08-03 20:48:26 +00:00
|
|
|
assert unexpected_stdout not in package_manager_detect.stdout
|
2020-12-01 10:02:31 +00:00
|
|
|
remi_package = Pihole.package('remi-release')
|
|
|
|
assert not remi_package.is_installed
|