2020-12-01 10:02:31 +00:00
|
|
|
from .conftest import (
|
|
|
|
tick_box,
|
|
|
|
info_box,
|
|
|
|
mock_command,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2021-11-18 01:03:37 +00:00
|
|
|
def test_php_upgrade_default_optout_centos_eq_7(host):
|
2020-12-01 10:02:31 +00:00
|
|
|
'''
|
|
|
|
confirms the default behavior to opt-out of installing PHP7 from REMI
|
|
|
|
'''
|
2021-11-18 01:03:37 +00:00
|
|
|
package_manager_detect = host.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
|
2021-09-12 20:40:37 +00:00
|
|
|
select_rpm_php
|
2020-12-01 10:02:31 +00:00
|
|
|
''')
|
|
|
|
expected_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 expected_stdout in package_manager_detect.stdout
|
2021-11-18 01:03:37 +00:00
|
|
|
remi_package = host.package('remi-release')
|
2020-12-01 10:02:31 +00:00
|
|
|
assert not remi_package.is_installed
|
|
|
|
|
|
|
|
|
2021-11-18 01:03:37 +00:00
|
|
|
def test_php_upgrade_user_optout_centos_eq_7(host):
|
2020-12-01 10:02:31 +00:00
|
|
|
'''
|
|
|
|
confirms installer behavior when user opt-out of installing PHP7 from REMI
|
|
|
|
(php not currently installed)
|
|
|
|
'''
|
2022-07-02 19:51:03 +00:00
|
|
|
# dialog returns Cancel for user prompt
|
|
|
|
mock_command('dialog', {'*': ('', '1')}, host)
|
2021-11-18 01:03:37 +00:00
|
|
|
package_manager_detect = host.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
|
2021-09-12 20:40:37 +00:00
|
|
|
select_rpm_php
|
2020-12-01 10:02:31 +00:00
|
|
|
''')
|
|
|
|
expected_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 expected_stdout in package_manager_detect.stdout
|
2021-11-18 01:03:37 +00:00
|
|
|
remi_package = host.package('remi-release')
|
2020-12-01 10:02:31 +00:00
|
|
|
assert not remi_package.is_installed
|
|
|
|
|
|
|
|
|
2021-11-18 01:03:37 +00:00
|
|
|
def test_php_upgrade_user_optin_centos_eq_7(host):
|
2020-12-01 10:02:31 +00:00
|
|
|
'''
|
|
|
|
confirms installer behavior when user opt-in to installing PHP7 from REMI
|
|
|
|
(php not currently installed)
|
|
|
|
'''
|
2022-07-02 19:51:03 +00:00
|
|
|
# dialog returns Continue for user prompt
|
|
|
|
mock_command('dialog', {'*': ('', '0')}, host)
|
2021-11-18 01:03:37 +00:00
|
|
|
package_manager_detect = host.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
|
2021-09-12 20:40:37 +00:00
|
|
|
select_rpm_php
|
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
|
|
|
expected_stdout = info_box + (' Enabling Remi\'s RPM repository '
|
|
|
|
'(https://rpms.remirepo.net)')
|
2021-08-03 20:48:26 +00:00
|
|
|
assert expected_stdout in package_manager_detect.stdout
|
2020-12-01 10:02:31 +00:00
|
|
|
expected_stdout = tick_box + (' Remi\'s RPM repository has '
|
|
|
|
'been enabled for PHP7')
|
2021-08-03 20:48:26 +00:00
|
|
|
assert expected_stdout in package_manager_detect.stdout
|
2021-11-18 01:03:37 +00:00
|
|
|
remi_package = host.package('remi-release')
|
2020-12-01 10:02:31 +00:00
|
|
|
assert remi_package.is_installed
|