mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-04-19 05:40:13 +00:00
Update the tests (#4427)
* unpin the requirements and update all to latest available - needs more work still. see notes in `def host()` Signed-off-by: Adam Warner <me@adamwarner.co.uk> * fix py3 monkey patch of testinfra docker using bash Signed-off-by: Adam Hill <adam@diginc.us> * update the other test files to use `host` instead of `Pihole` Address some sticklr and codefactor update python version from 3.7 to 3.8 preload `git` onto the centos/fedora test images, and switch which with command -v in the passthrough mock testinfra is deprecated, use pytest-testinfra Signed-off-by: Adam Warner <me@adamwarner.co.uk> Co-authored-by: Adam Hill <adam@diginc.us>
This commit is contained in:
parent
cedd1a2591
commit
cdd4d9ea9e
25 changed files with 285 additions and 322 deletions
|
@ -5,12 +5,12 @@ from .conftest import (
|
|||
)
|
||||
|
||||
|
||||
def test_php_upgrade_default_continue_centos_gte_8(Pihole):
|
||||
def test_php_upgrade_default_continue_centos_gte_8(host):
|
||||
'''
|
||||
confirms the latest version of CentOS continues / does not optout
|
||||
(should trigger on CentOS7 only)
|
||||
'''
|
||||
package_manager_detect = Pihole.run('''
|
||||
package_manager_detect = host.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
package_manager_detect
|
||||
select_rpm_php
|
||||
|
@ -19,19 +19,19 @@ def test_php_upgrade_default_continue_centos_gte_8(Pihole):
|
|||
' Deprecated PHP may be in use.')
|
||||
assert unexpected_stdout not in package_manager_detect.stdout
|
||||
# ensure remi was not installed on latest CentOS
|
||||
remi_package = Pihole.package('remi-release')
|
||||
remi_package = host.package('remi-release')
|
||||
assert not remi_package.is_installed
|
||||
|
||||
|
||||
def test_php_upgrade_user_optout_skipped_centos_gte_8(Pihole):
|
||||
def test_php_upgrade_user_optout_skipped_centos_gte_8(host):
|
||||
'''
|
||||
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)
|
||||
package_manager_detect = Pihole.run('''
|
||||
mock_command('whiptail', {'*': ('', '1')}, host)
|
||||
package_manager_detect = host.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
package_manager_detect
|
||||
select_rpm_php
|
||||
|
@ -40,19 +40,19 @@ def test_php_upgrade_user_optout_skipped_centos_gte_8(Pihole):
|
|||
' Deprecated PHP may be in use.')
|
||||
assert unexpected_stdout not in package_manager_detect.stdout
|
||||
# ensure remi was not installed on latest CentOS
|
||||
remi_package = Pihole.package('remi-release')
|
||||
remi_package = host.package('remi-release')
|
||||
assert not remi_package.is_installed
|
||||
|
||||
|
||||
def test_php_upgrade_user_optin_skipped_centos_gte_8(Pihole):
|
||||
def test_php_upgrade_user_optin_skipped_centos_gte_8(host):
|
||||
'''
|
||||
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)
|
||||
package_manager_detect = Pihole.run('''
|
||||
mock_command('whiptail', {'*': ('', '0')}, host)
|
||||
package_manager_detect = host.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
package_manager_detect
|
||||
select_rpm_php
|
||||
|
@ -64,5 +64,5 @@ def test_php_upgrade_user_optin_skipped_centos_gte_8(Pihole):
|
|||
unexpected_stdout = tick_box + (' Remi\'s RPM repository has '
|
||||
'been enabled for PHP7')
|
||||
assert unexpected_stdout not in package_manager_detect.stdout
|
||||
remi_package = Pihole.package('remi-release')
|
||||
remi_package = host.package('remi-release')
|
||||
assert not remi_package.is_installed
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue