Skip to content

Commit 012fae2

Browse files
committed
Mock the ISPyBSession instance imported in 'register_data_collection_group'
1 parent 4fa863b commit 012fae2

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/workflows/clem/test_register_preprocessing_results.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,16 +182,21 @@ def test_run_with_db(
182182
},
183183
)
184184

185-
# Mock out module-level functions
185+
# Mock the ISPyB connection where the TransportManager class is located
186186
mock_security_config = MagicMock()
187187
mock_security_config.ispyb_credentials = mock_ispyb_credentials
188188
mock_get_security_config = mocker.patch("murfey.server.ispyb.get_security_config")
189189
mock_get_security_config.return_value = mock_security_config
190190

191-
# Mock the ISPyB connection
192191
mock_ispyb_sessionmaker = mocker.patch("murfey.server.ispyb.sessionmaker")
193192
mock_ispyb_sessionmaker.return_value.return_value = ispyb_db_session
194193

194+
# Mock the ISPYB connection when registering data collection group
195+
mocker.patch(
196+
"murfey.workflows.register_data_collection_group.ISPyBSession",
197+
return_value=ispyb_db_session,
198+
)
199+
195200
# Mock out the machine config used in the helper sanitisation function
196201
mock_get_machine_config = mocker.patch("murfey.workflows.clem.get_machine_config")
197202
mock_machine_config = MagicMock()

0 commit comments

Comments
 (0)