コード例 #1
0
 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)
コード例 #2
0
ファイル: tasks.py プロジェクト: credativ/pulp
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
コード例 #3
0
ファイル: tasks.py プロジェクト: taftsanders/pulp
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
コード例 #4
0
ファイル: test_dispatch.py プロジェクト: alanoe/pulp
 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)
コード例 #5
0
ファイル: test_dispatch.py プロジェクト: alanoe/pulp
 def test_spawned_tasks_none(self):
     result = dispatch.spawned_tasks({'spawned_tasks': None})
     target_dict = {'spawned_tasks': []}
     compare_dict(result, target_dict)
コード例 #6
0
 def test_spawned_tasks_none(self):
     result = dispatch.spawned_tasks({'spawned_tasks': None})
     target_dict = {'spawned_tasks': []}
     compare_dict(result, target_dict)