Skip to content

Commit 6eb8416

Browse files
committed
Added minimal changes needed to test the '_make_thumbnail' function
1 parent 29e8668 commit 6eb8416

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

tests/workflows/fib/test_register_atlas.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
from unittest.mock import MagicMock
44

55
import ispyb.sqlalchemy as ISPyBDB
6+
import numpy as np
7+
import PIL.Image
68
import pytest
79
from pytest_mock import MockerFixture
810
from sqlalchemy import select as sa_select
@@ -381,6 +383,12 @@ def test_run_with_db(
381383
"_register_fib_imaging_site",
382384
)
383385

386+
# Mock 'PIL.Image.open' and create a test image
387+
mocker.patch(
388+
"murfey.workflows.fib.register_atlas.PIL.Image.open",
389+
return_value=PIL.Image.fromarray(np.ones((2048, 1152), dtype=np.uint8)),
390+
)
391+
384392
# Run the function and check that it's run through to completion
385393
for test_file in test_files:
386394
run(
@@ -436,3 +444,7 @@ def test_run_with_db(
436444
.all()
437445
)
438446
assert len(ispyb_atlas_search) == 1
447+
ispyb_atlas_entry = ispyb_atlas_search[0]
448+
assert ispyb_atlas_entry.atlasImage.endswith(
449+
f"atlas_{str(mock_metadata[-1].slot_number).zfill(2)}.png"
450+
)

0 commit comments

Comments
 (0)