'Test the ability to re-schedule a task.'

def testReSchedule(self):

    test_queue = rdfvalue.RDFURN('fooReschedule')
    task = rdf_flows.GrrMessage(queue=test_queue, task_ttl=5, session_id='aff4:/Test', generate_task_id=True)
    manager = queue_manager.QueueManager(token=self.token)
    manager.Schedule([task])
    tasks = manager.QueryAndOwn(test_queue, lease_seconds=100, limit=100)
    self.assertEqual(len(tasks), 1)
    original_id = tasks[0].task_id
    tasks_2 = manager.QueryAndOwn(test_queue, lease_seconds=100, limit=100)
    self.assertEqual(len(tasks_2), 0)
    manager.Schedule(tasks)
    self.assertEqual(tasks[0].task_id, original_id)
    tasks = manager.QueryAndOwn(test_queue, lease_seconds=100, limit=100)
    self.assertEqual(len(tasks), 1)
    self.assertEqual(tasks[0].task_id, original_id)
