def test_spawned_tasks(self): result = dispatch.spawned_tasks({'spawned_tasks': ['apple']}) target_dict = { 'spawned_tasks': [dispatch.link_obj('/pulp/api/v2/tasks/apple/')] } target_dict['spawned_tasks'][0].update({'task_id': 'apple'}) compare_dict(result, target_dict)
def task_serializer(task): """ Update the task representation in the database to match the model for the API :param task: The task from the database :type task: dict :return: the same task modified for use by the API :rtype: dict """ task = serial_dispatch.task_status(task) task.update(serial_dispatch.spawned_tasks(task)) task.update(serial_dispatch.task_result_href(task)) return task
def test_spawned_tasks(self): result = dispatch.spawned_tasks({'spawned_tasks': ['apple']}) target_dict = {'spawned_tasks': [dispatch.link_obj('/pulp/api/v2/tasks/apple/')]} target_dict['spawned_tasks'][0].update({'task_id': 'apple'}) compare_dict(result, target_dict)
def test_spawned_tasks_none(self): result = dispatch.spawned_tasks({'spawned_tasks': None}) target_dict = {'spawned_tasks': []} compare_dict(result, target_dict)