From a29fc32723f125aef1fb70d4ba74ac20d74a1702 Mon Sep 17 00:00:00 2001 From: Stefano Borini <sborini@enthought.com> Date: Tue, 22 May 2018 17:00:25 +0100 Subject: [PATCH] coverage --- force_bdss/tests/test_core_mco_driver.py | 34 ++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/force_bdss/tests/test_core_mco_driver.py b/force_bdss/tests/test_core_mco_driver.py index abe17a2..d137b21 100644 --- a/force_bdss/tests/test_core_mco_driver.py +++ b/force_bdss/tests/test_core_mco_driver.py @@ -202,3 +202,37 @@ class TestCoreMCODriver(unittest.TestCase): "'force.bdss.enthought.plugin.test.v0'" " raised exception. This might indicate " 'a programming error in the plugin.'),) + + def test_nonexistent_file(self): + self.mock_application.workflow_filepath = fixtures.get( + "test_nonexistent.json") + driver = CoreMCODriver( + application=self.mock_application, + ) + with LogCapture() as capture: + with self.assertRaises(SystemExit): + driver.application_started() + capture.check( + ('force_bdss.core_mco_driver', 'ERROR', + 'Unable to open workflow file.'), + ) + + def test_non_valid_file(self): + self.mock_application.workflow_filepath = fixtures.get( + "test_null.json") + driver = CoreMCODriver( + application=self.mock_application, + ) + with LogCapture() as capture: + with self.assertRaises(SystemExit): + driver.application_started() + capture.check( + ('force_bdss.core_mco_driver', + 'ERROR', + 'Unable to execute workflow due to verification errors :'), + ('force_bdss.core_mco_driver', 'ERROR', + 'MCO has no defined parameters'), + ('force_bdss.core_mco_driver', 'ERROR', + 'Missing input slot name assignment'), + ('force_bdss.core_mco_driver', 'ERROR', + 'Missing output slot name assignment')) -- GitLab