Skip to content

Commit b15a463

Browse files
committed
Try fixing tests
1 parent 1de4a89 commit b15a463

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

tests/server/test_ispyb.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,27 @@ def test_get_all_ongoing_visits():
7373

7474
@mock.patch("workflows.transport.pika_transport.PikaTransport")
7575
def test_update_data_collection_group(mock_transport, ispyb_db_session: Session):
76+
# Manually get the BLSession ID for comparison
77+
bl_session_id = (
78+
ispyb_db_session.execute(
79+
select(BLSession)
80+
.join(Proposal)
81+
.where(BLSession.proposalId == Proposal.proposalId)
82+
.where(BLSession.beamLineName == ExampleVisit.instrument_name)
83+
.where(Proposal.proposalCode == ExampleVisit.proposal_code)
84+
.where(Proposal.proposalNumber == str(ExampleVisit.proposal_number))
85+
.where(BLSession.visit_number == ExampleVisit.visit_number)
86+
)
87+
.scalar_one()
88+
.sessionId
89+
)
90+
# Insert data collection group
7691
get_or_create_db_entry(
7792
session=ispyb_db_session,
7893
table=DataCollectionGroup,
7994
insert_kwargs={
8095
"dataCollectionGroupId": 1,
81-
"sessionId": 0,
96+
"sessionId": bl_session_id,
8297
"experimentTypeId": 1,
8398
},
8499
)

tests/workflows/tomo/test_tomo_metadata.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,14 @@ def test_register_search_map_update_with_all_parameters(
137137
# Check this would have updated ispyb
138138
update_args = mock_transport.do_update_search_map.call_args_list
139139
assert len(update_args) == 2
140-
assert update_args[0][0] == 1
141-
assert update_args[1][0] == 1
142-
assert update_args[0][1].x_location == new_parameters.x_location
143-
assert update_args[0][1].y_location == new_parameters.y_location
144-
assert update_args[1][1].x_location == sm_final_parameters.x_location
145-
assert update_args[1][1].x_location == sm_final_parameters.y_location
146-
assert update_args[1][1].height_on_atlas == int(40 * 7.8)
147-
assert update_args[1][1].width_on_atlas == int(20 * 7.8)
140+
assert update_args[0][0][0] == 1
141+
assert update_args[0][1][0] == 1
142+
assert update_args[0][0][1].x_stage_position == 0.3
143+
assert update_args[0][0][1].y_stage_position == 0.4
144+
assert update_args[0][1][1].x_location == sm_final_parameters.x_location
145+
assert update_args[0][1][1].x_location == sm_final_parameters.y_location
146+
assert update_args[0][1][1].height_on_atlas == int(40 * 7.8)
147+
assert update_args[0][1][1].width_on_atlas == int(20 * 7.8)
148148

149149

150150
@mock.patch("murfey.workflows.tomo.tomo_metadata._transport_object")

0 commit comments

Comments
 (0)