Skip to content

Commit 409f9a4

Browse files
committed
Fixed broken test
1 parent 94d95a8 commit 409f9a4

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

tests/workflows/fib/test_register_atlas.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from sqlmodel import Session, select
88

99
import murfey.util.db as MurfeyDB
10+
import murfey.workflows.fib.register_atlas
1011
from murfey.workflows.fib.register_atlas import FIBAtlasMetadata, _parse_metadata, run
1112

1213
session_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

Comments
 (0)