예제 #1
0
def spawned_tasks(task):
    """
    For a given Task dictionary convert the spawned tasks list of ids to
    a list of link objects

    :param task: The dictionary representation of a task object in the database
    :type task: dict
    """
    spawned_tasks = []
    spawned = task.get('spawned_tasks')
    if spawned:
        for spawned_task_id in spawned:
            link = link_obj('/pulp/api/v2/tasks/%s/' % spawned_task_id)
            link['task_id'] = spawned_task_id
            spawned_tasks.append(link)
    return {'spawned_tasks': spawned_tasks}
예제 #2
0
 def test_link_obj(self):
     ret = link.link_obj('/base/uri/repo1/')
     self.assertEqual(ret, {'_href': '/base/uri/repo1/'})
예제 #3
0
 def test_link_obj(self):
     ret = link.link_obj('/base/uri/repo1/')
     self.assertEqual(ret, {'_href': '/base/uri/repo1/'})