File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -312,45 +312,42 @@ def test_run_with_db(
312312 murfey_db_session .commit ()
313313
314314 # Mock the metadata returned from the image file
315- mock_metadata = [
316- FIBAtlasMetadata (
317- visit_name = visit_name ,
318- file = test_file ,
319- voltage = 2000 ,
320- shift_x = 0 ,
321- shift_y = 0 ,
322- len_x = 0.003072 ,
323- len_y = 0.002048 ,
324- pos_x = 0.003 ,
325- pos_y = 0.0003 ,
326- pos_z = 0.01 ,
327- rotation = - 1.309 ,
328- tilt_alpha = 0.8 ,
329- tilt_beta = 0 ,
330- pixels_x = 3072 ,
331- pixels_y = 2048 ,
332- pixel_size_x = 1e-6 ,
333- pixel_size_y = 1e-6 ,
334- )
335- for test_file in test_files
336- ]
337- mocker .patch (
315+ mock_metadata = FIBAtlasMetadata (
316+ visit_name = visit_name ,
317+ file = test_files [0 ],
318+ voltage = 2000 ,
319+ shift_x = 0 ,
320+ shift_y = 0 ,
321+ len_x = 0.003072 ,
322+ len_y = 0.002048 ,
323+ pos_x = 0.003 ,
324+ pos_y = 0.0003 ,
325+ pos_z = 0.01 ,
326+ rotation = - 1.309 ,
327+ tilt_alpha = 0.8 ,
328+ tilt_beta = 0 ,
329+ pixels_x = 3072 ,
330+ pixels_y = 2048 ,
331+ pixel_size_x = 1e-6 ,
332+ pixel_size_y = 1e-6 ,
333+ )
334+ mock_parse = mocker .patch (
338335 "murfey.workflows.fib.register_atlas._parse_metadata" ,
339- side_effect = mock_metadata ,
336+ return_value = mock_metadata ,
340337 )
341338
342339 # Run the function and check that it's run through to completion
343- for test_file in test_files :
344- run (
345- session_id = session_id ,
346- file = test_file ,
347- murfey_db = murfey_db_session ,
348- )
340+ run (
341+ session_id = session_id ,
342+ file = test_files [0 ],
343+ murfey_db = murfey_db_session ,
344+ )
349345 search_results = murfey_db_session .exec (
350346 select (MurfeyDB .ImagingSite ).where (
351347 MurfeyDB .ImagingSite .session_id == session_id
352348 )
353349 ).all ()
354350
351+ assert mock_parse .call_count == 1
355352 assert len (search_results ) == 1
356- assert search_results [0 ].image_path == str (mock_metadata [ - 1 ] .file )
353+ assert search_results [0 ].image_path == str (mock_metadata .file )
You can’t perform that action at this time.
0 commit comments