From 2a5587f23677bc65667b89ed7af93c540422201c Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sat, 28 Jan 2017 15:49:28 -0800 Subject: [PATCH] Test for failure. --- test/test_automated_install.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/test_automated_install.py b/test/test_automated_install.py index c502aef6..4ab6e3a3 100644 --- a/test/test_automated_install.py +++ b/test/test_automated_install.py @@ -283,6 +283,16 @@ def test_update_package_cache_success_no_errors(Pihole): assert 'Updating local cache of available packages...' in updateCache.stdout assert 'done!' in updateCache.stdout +def test_update_package_cache_failure_no_errors(Pihole): + ''' confirms package cache was updated without any errors''' + mock_command('apt-get', {'*':('', '1')}, Pihole) + updateCache = Pihole.run(''' + source /opt/pihole/basic-install.sh + update_package_cache + ''') + assert 'Updating local cache of available packages...' in updateCache.stdout + assert 'done!' not in updateCache.stdout + # Helper functions def mock_command(script, args, container): ''' Allows for setup of commands we don't really want to have to run for real in unit tests '''