diff --git a/lib/galaxy/model/__init__.py b/lib/galaxy/model/__init__.py index 9b0b2d63b89..b1b3e738b4c 100644 --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -3081,20 +3081,22 @@ class WorkflowInvocation( object, Dictifiable ): def to_dict( self, view='collection', value_mapper=None ): rval = super( WorkflowInvocation, self ).to_dict( view=view, value_mapper=value_mapper ) if view == 'element': - steps = {} + steps = [] for step in self.steps: v = step.to_dict() - steps[str(v['order_index'])] = v + steps.append( v ) rval['steps'] = steps inputs = {} for step in self.steps: if step.workflow_step.type == 'tool': for step_input in step.workflow_step.input_connections: - if step_input.output_step.type == 'data_input': + output_step_type = step_input.output_step.type + if output_step_type in [ 'data_input', 'data_collection_input' ]: + src = "hda" if output_step_type == 'data_input' else 'hdca' for job_input in step.job.input_datasets: if job_input.name == step_input.input_name: - inputs[str(step_input.output_step.order_index)] = { "id": job_input.dataset_id, "src": "hda"} + inputs[str(step_input.output_step.order_index)] = { "id": job_input.dataset_id, "src": src } rval['inputs'] = inputs return rval diff --git a/test/api/test_workflows.py b/test/api/test_workflows.py index afeaab66b4c..e714f93688f 100644 --- a/test/api/test_workflows.py +++ b/test/api/test_workflows.py @@ -520,8 +520,8 @@ class WorkflowsApiTestCase( api.ApiTestCase ): usage_details = usage_details_response.json() # Assert some high-level things about the structure of data returned. self._assert_has_keys( usage_details, "inputs", "steps" ) - for step in usage_details[ "steps" ].values(): - self._assert_has_keys( step, "workflow_step_id", "order_index" ) + for step in usage_details[ "steps" ]: + self._assert_has_keys( step, "workflow_step_id", "order_index", "id" ) @skip_without_tool( "cat1" ) def test_post_job_action( self ):