@@ -124,9 +124,10 @@ def test_execution_with_deferred_src_urls(self):
124124 assert input_dataset_details ["state" ] == "deferred" , input_dataset_details
125125
126126 @skip_without_tool ("gx_data_collection_list" )
127- def test_execution_with_deferred_collection (self ):
127+ def test_execution_with_deferred_list (self ):
128128 with self .dataset_populator .test_history () as history_id :
129- input_b64_1 = base64 .b64encode (b"1 2 3" ).decode ("utf-8" )
129+ input_b64_1 = base64 .b64encode (b"Hello World!\n " ).decode ("utf-8" )
130+ input_b64_2 = base64 .b64encode (b"It is me - a collection!\n " ).decode ("utf-8" )
130131 response = self ._run (
131132 "gx_data_collection_list" ,
132133 history_id ,
@@ -141,7 +142,14 @@ def test_execution_with_deferred_collection(self):
141142 "url" : f"base64://{ input_b64_1 } " ,
142143 "ext" : "txt" ,
143144 "deferred" : True ,
144- }
145+ },
146+ {
147+ "class" : "File" ,
148+ "identifier" : "mycoolelement2" ,
149+ "url" : f"base64://{ input_b64_2 } " ,
150+ "ext" : "txt" ,
151+ "deferred" : False ,
152+ },
145153 ],
146154 },
147155 },
@@ -164,11 +172,67 @@ def test_execution_with_deferred_collection(self):
164172 job_output = job_outputs [0 ]
165173 assert job_output ["name" ] == "output"
166174 content = self .dataset_populator .get_history_dataset_content (history_id , dataset = job_output ["dataset" ])
167- assert content == "Hello World!"
175+ assert content == "Hello World!\n It is me - a collection! \n "
168176
169- # verify input was left deferred and infer must have been materialized just for the job
170- input_dataset_details = self .dataset_populator .get_history_dataset_details (history_id , hid = 1 )
171- assert input_dataset_details ["state" ] == "deferred" , input_dataset_details
177+ @skip_without_tool ("gx_data_collection" )
178+ def test_execution_with_deferred_nested_list (self ):
179+ with self .dataset_populator .test_history () as history_id :
180+ input_b64_1 = base64 .b64encode (b"Hello World!\n " ).decode ("utf-8" )
181+ input_b64_2 = base64 .b64encode (b"It is me - a collection!\n " ).decode ("utf-8" )
182+ response = self ._run (
183+ "gx_data_collection" ,
184+ history_id ,
185+ {
186+ "parameter" : {
187+ "class" : "Collection" ,
188+ "collection_type" : "list:list" ,
189+ "elements" : [
190+ {
191+ # Why is this needed? Planemo doesn't require this class right?
192+ # wait is it needed?
193+ "class" : "Collection" ,
194+ "identifier" : "outer_element" ,
195+ "collection_type" : "list" ,
196+ "elements" : [
197+ {
198+ "class" : "File" ,
199+ "identifier" : "mycoolelement" ,
200+ "url" : f"base64://{ input_b64_1 } " ,
201+ "ext" : "txt" ,
202+ "deferred" : True ,
203+ },
204+ {
205+ "class" : "File" ,
206+ "identifier" : "mycoolelement2" ,
207+ "url" : f"base64://{ input_b64_2 } " ,
208+ "ext" : "txt" ,
209+ "deferred" : False ,
210+ },
211+ ],
212+ }
213+ ],
214+ },
215+ },
216+ )
217+ assert_status_code_is_ok (response )
218+ response_json = response .json ()
219+ tool_request_id = response_json .get ("tool_request_id" )
220+ task_result = response_json ["task_result" ]
221+ self .dataset_populator .wait_on_task_object (task_result )
222+ state = self .dataset_populator .wait_on_tool_request (tool_request_id )
223+ assert state , str (self .dataset_populator .get_tool_request (tool_request_id ))
224+ jobs = self .galaxy_interactor .jobs_for_tool_request (tool_request_id )
225+ self .dataset_populator .wait_for_jobs (jobs , assert_ok = True )
226+ if len (jobs ) != 1 :
227+ raise Exception (f"Found incorrect number of jobs for tool request - was expecting a single job { jobs } " )
228+ assert len (jobs ) == 1 , jobs
229+ job_id = jobs [0 ]["id" ]
230+ job_outputs = self .galaxy_interactor .job_outputs (job_id )
231+ assert len (job_outputs ) == 1
232+ job_output = job_outputs [0 ]
233+ assert job_output ["name" ] == "output"
234+ content = self .dataset_populator .get_history_dataset_content (history_id , dataset = job_output ["dataset" ])
235+ assert content == "Hello World!\n It is me - a collection!\n "
172236
173237 def _assert_request_validates (self , tool_id : str , history_id : str , inputs : Dict [str , Any ]):
174238 response = self ._run (tool_id , history_id , inputs )
0 commit comments