77from sqlmodel import Session , select
88
99import murfey .util .db as MurfeyDB
10+ import murfey .workflows .fib .register_atlas
1011from murfey .workflows .fib .register_atlas import FIBAtlasMetadata , _parse_metadata , run
1112
1213session_id = 10
@@ -334,10 +335,14 @@ def test_run_with_db(
334335 )
335336 for test_file in test_files
336337 ]
337- mocker .patch (
338+ mock_parse = mocker .patch (
338339 "murfey.workflows.fib.register_atlas._parse_metadata" ,
339340 side_effect = mock_metadata ,
340341 )
342+ spy_register = mocker .spy (
343+ murfey .workflows .fib .register_atlas ,
344+ "_register_fib_imaging_site" ,
345+ )
341346
342347 # Run the function and check that it's run through to completion
343348 for test_file in test_files :
@@ -346,11 +351,13 @@ def test_run_with_db(
346351 file = test_file ,
347352 murfey_db = murfey_db_session ,
348353 )
354+ assert mock_parse .call_count == len (test_files )
355+ assert spy_register .call_count == len (test_files )
356+
349357 search_results = murfey_db_session .exec (
350358 select (MurfeyDB .ImagingSite ).where (
351359 MurfeyDB .ImagingSite .session_id == session_id
352360 )
353361 ).all ()
354-
355362 assert len (search_results ) == 1
356363 assert search_results [0 ].image_path == str (mock_metadata [- 1 ].file )
0 commit comments