@@ -338,25 +338,26 @@ def test_algorithm(client, settings, django_capture_on_commit_callbacks):
338338 django_capture_on_commit_callbacks = django_capture_on_commit_callbacks ,
339339 )
340340
341- jobs = Job .objects .filter (algorithm_image = ai ).all ()
342-
343341 # There should be a single, successful job
344- assert len ( jobs ) == 1
342+ job = Job . objects . filter ( algorithm_image = ai ). get ()
345343
346- assert jobs [0 ].stdout .endswith ("Greetings from stdout" )
347- assert jobs [0 ].stderr .endswith ('("Hello from stderr")' )
348- assert "UserWarning: Could not google: [Errno " in jobs [0 ].stderr
349- assert jobs [0 ].error_message == ""
350- assert jobs [0 ].status == jobs [0 ].SUCCESS
344+ assert job .stdout .endswith ("Greetings from stdout" )
345+ assert job .stderr .endswith ('("Hello from stderr")' )
346+ assert "UserWarning: Could not google: [Errno " in job .stderr
347+ assert job .error_message == ""
348+ assert job .status == job .SUCCESS
349+ assert job .exec_duration == timedelta (seconds = 1337 )
350+ assert job .invoke_duration == timedelta (seconds = 1874 )
351+ assert job .utilization .duration .total_seconds () > 0
351352
352353 # The job should have two ComponentInterfaceValues,
353354 # one for the results.json and one for output.tif
354- assert len (jobs [ 0 ] .outputs .all ()) == 2
355+ assert len (job .outputs .all ()) == 2
355356
356- json_result_civ = jobs [ 0 ] .outputs .get (interface = json_result_interface )
357+ json_result_civ = job .outputs .get (interface = json_result_interface )
357358 assert json_result_civ .value
358359
359- heatmap_civ = jobs [ 0 ] .outputs .get (interface = heatmap_interface )
360+ heatmap_civ = job .outputs .get (interface = heatmap_interface )
360361 assert heatmap_civ .image .name == "input_file.tif"
361362
362363 # We add another ComponentInterface with file value and run the algorithm again
0 commit comments