def test_cancel_task(self): """Test to cancel a task.""" 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(task) self.assertTrue(get_task('badtask') is None) self.assertTrue('badtask' not in get_tasks())
def test_rename_task(self): """Test renaming a single task.""" task = add_single_task(functest, taskname='footask') self.assertEqual(task.name, 'footask') self.assertEqual(get_task('footask'), task) self.assertTrue(get_task('bartask') is None) self.assertTrue('footask' in get_tasks()) self.assertTrue('bartask' not in get_tasks()) rename_task('footask', 'bartask') self.assertEqual(task.name, 'bartask') self.assertTrue(get_task('footask') is None) self.assertEqual(get_task('bartask'), task) self.assertTrue('footask' not in get_tasks()) self.assertTrue('bartask' in get_tasks())
def test_single_task(self): """Test adding a single task.""" task = add_single_task(functest, taskname='singletest') self.assertEqual(task.action, functest) self.assertEqual(task.name, 'singletest')
def test_duplicate_task(self): """Test adding a task with the same name as an existing task.""" add_single_task(functest, taskname='duplicate') self.assertRaises(ValueError, add_single_task, functest, taskname='duplicate')