Skip to content

Commit c654ddd

Browse files
committed
Mock without the call method
1 parent 1a496f8 commit c654ddd

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

tests/server/test_ispyb.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,7 @@ def test_get_all_ongoing_visits():
7272

7373

7474
@mock.patch("workflows.transport.pika_transport.PikaTransport")
75-
@mock.patch("murfey.server.ispyb.ISPyBSession.__call__")
76-
def test_update_data_collection_group(
77-
mock_ispyb_session_call, mock_transport, ispyb_db_session: Session
78-
):
79-
mock_ispyb_session_call.return_value = ispyb_db_session
80-
75+
def test_update_data_collection_group(mock_transport, ispyb_db_session: Session):
8176
# Manually get the BLSession ID for comparison
8277
bl_session_id = (
8378
ispyb_db_session.execute(
@@ -104,9 +99,10 @@ def test_update_data_collection_group(
10499
)
105100

106101
transport_manager = TransportManager("PikaTransport")
107-
transport_manager.do_update_data_collection_group(
108-
record=DataCollectionGroup(dataCollectionGroupId=1, experimentTypeId=2)
109-
)
102+
with mock.patch("murfey.server.ispyb.ISPyBSession", ispyb_db_session):
103+
transport_manager.do_update_data_collection_group(
104+
record=DataCollectionGroup(dataCollectionGroupId=1, experimentTypeId=2)
105+
)
110106

111107
final_dcg_entry = get_or_create_db_entry(
112108
session=ispyb_db_session,

0 commit comments

Comments
 (0)