def test_cancel_task_not_exists(self): """Test to cancel a task that does not exist.""" self.assertTrue(get_task('badtask') is None) self.assertTrue('badtask' not in get_tasks()) cancel('badtask') self.assertTrue(get_task('badtask') is None) self.assertTrue('badtask' not in get_tasks())
def test_cancel_task_by_name(self): """Test to cancel a task using its taskname.""" task = add_single_task(functest, taskname='badtask') self.assertEqual(task.name, 'badtask') self.assertEqual(get_task('badtask'), task) self.assertTrue('badtask' in get_tasks()) cancel('badtask') self.assertTrue(get_task('badtask') is None) self.assertTrue('badtask' not in get_tasks())