'Test that we can delete tasks.'

def testDelete(self):

    test_queue = rdfvalue.RDFURN('fooDelete')
    task = rdf_flows.GrrMessage(queue=test_queue, 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)
    self.assertEqual(tasks[0].session_id, 'aff4:/Test')
    manager.Delete(test_queue, tasks)
    (value, ts) = data_store.DB.Resolve(test_queue, ('task:%08d' % task.task_id), token=self.token)
    self.assertEqual(value, None)
    self.assertEqual(ts, 0)
    self._current_mock_time += 1000
    tasks = manager.QueryAndOwn(test_queue, lease_seconds=100, limit=100)
    self.assertEqual(len(tasks), 0)
