From ee556088b5dea283ec63d0c82b147d7f434242cd Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Fri, 23 Oct 2020 23:05:41 +0100 Subject: [PATCH] Fake OS details in /etc/os-release and confirm install fails Signed-off-by: Adam Warner --- test/test_automated_install.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/test/test_automated_install.py b/test/test_automated_install.py index 8d894b5a..300f622e 100644 --- a/test/test_automated_install.py +++ b/test/test_automated_install.py @@ -563,6 +563,24 @@ def test_validate_ip_invalid_letters(Pihole): assert output.rc == 1 +def test_os_check_fails(Pihole): + ''' Confirms install fails on unsupported OS ''' + Pihole.run(''' + source /opt/pihole/basic-install.sh + distro_check + install_dependent_packages ${INSTALLER_DEPS[@]} + cat < /etc/os-release + ID=UnsupportedOS + VERSION_ID="2" + EOT + ''') + detectOS = Pihole.run('''t + source /opt/pihole/basic-install.sh + os_check + ''') + expected_stdout = 'Unsupported OS detected: UnsupportedOS' + assert expected_stdout in detectOS.stdout + def test_os_check_passes(Pihole): ''' Confirms OS meets the requirements ''' Pihole.run(''' @@ -575,4 +593,4 @@ def test_os_check_passes(Pihole): os_check ''') expected_stdout = 'Supported OS detected' - assert expected_stdout in detectOS.stdout + assert expected_stdout in detectOS.stdout \ No newline at end of file