def test_unary(self): """ Test to execute one void action. """ results = tasks(confs='one') self.assertEqual(results, [{RESULT: 1, ERROR: None}])
def test_empty(self): """ Test to execute empty tasks. """ results = tasks() self.assertEqual(len(results), 0)
def test_exception(self): """ Test to run an action which raises an exception. """ results = tasks(confs='error') self.assertEqual(len(results), 1) self.assertIsNone(results[0][RESULT]) self.assertTrue(isinstance(results[0][ERROR], NotImplementedError))
def test_many(self): """ Test to run tasks without errors. """ confs = ["action", "error", "one"] _results = [ {RESULT: None, ERROR: None}, {RESULT: None, ERROR: self.error}, {RESULT: 1, ERROR: None} ] results = tasks(confs=confs) self.assertEqual(len(results), len(confs)) self.assertEqual(_results, results)