← Back to team overview

nagios-charmers team mailing list archive

[Merge] ~xavpaice/hw-health-charm:fix_unittests into hw-health-charm:master

 

Xav Paice has proposed merging ~xavpaice/hw-health-charm:fix_unittests into hw-health-charm:master.

Requested reviews:
  Nagios Charm developers (nagios-charmers)

For more details, see:
https://code.launchpad.net/~xavpaice/hw-health-charm/+git/hw-health-charm/+merge/363403
-- 
Your team Nagios Charm developers is requested to review the proposed merge of ~xavpaice/hw-health-charm:fix_unittests into hw-health-charm:master.
diff --git a/src/tests/unit/test_cron_mdadm.py b/src/tests/unit/test_cron_mdadm.py
index dffd65b..647381f 100644
--- a/src/tests/unit/test_cron_mdadm.py
+++ b/src/tests/unit/test_cron_mdadm.py
@@ -28,13 +28,14 @@ class TestCronMdadm(unittest.TestCase):
         self.assertEqual(cron_mdadm.get_devices(), set())
 
     @mock.patch('os.path.exists')
-    @mock.patch('subprocess.Popen')
-    def test_get_devices_mdadm_exception(self, mdadm_details, path_exists):
+    @mock.patch('subprocess.check_output')
+    @mock.patch('sys.exit')
+    def test_get_devices_mdadm_exception(self, mock_exit, mock_check_output, path_exists):
         path_exists.return_value = True
-        mdadm_details.side_effect = subprocess.CalledProcessError(
-            1, 'unittest')
+        mock_check_output.side_effect = subprocess.CalledProcessError(1, 'unittest')
+        mock_exit.return_value = []
         self.assertEqual(cron_mdadm.get_devices(), set())
-
+        
     @mock.patch('cron_mdadm.generate_output')
     @mock.patch('cron_mdadm.get_devices')
     @mock.patch('subprocess.check_output')