def redo(testcase, testcase_tasks, user_email): """Redo tasks.""" try: tasks.redo_testcase(testcase, testcase_tasks, user_email) except tasks.InvalidRedoTask as error: raise helpers.EarlyExitException(error.message, 400) helpers.log( 'Redo testcase %d: %s' % (testcase.key.id(), testcase_tasks), helpers.MODIFY_OPERATION)
def test_invalid_task(self): """Raise an exception on an invalid task.""" with self.assertRaises(tasks.InvalidRedoTask) as cm: tasks.redo_testcase(None, ['blame', 'rand'], '*****@*****.**') self.assertEqual("The task 'rand' is invalid.", cm.exception.message)