1- from ispyb .sqlalchemy import BLSession , DataCollectionGroup , Proposal
1+ from ispyb .sqlalchemy import BLSession , Proposal
22from pytest import mark
33from sqlalchemy import select
44from sqlalchemy .orm import Session
55
6- from murfey .server .ispyb import (
7- get_data_collection_group_ids ,
8- get_proposal_id ,
9- get_session_id ,
10- )
11- from tests .conftest import ExampleVisit , ISPyBTableValues
6+ from murfey .server .ispyb import get_proposal_id , get_session_id
7+ from tests .conftest import ExampleVisit
128
139
1410def test_get_session_id (
@@ -48,7 +44,7 @@ def test_get_proposal_id(
4844 ispyb_db_session .execute (
4945 select (Proposal )
5046 .where (Proposal .proposalCode == ExampleVisit .proposal_code )
51- .where (Proposal .proposalNumber == ExampleVisit .proposal_number )
47+ .where (Proposal .proposalNumber == str ( ExampleVisit .proposal_number ) )
5248 )
5349 .scalar_one ()
5450 .proposalId
@@ -57,7 +53,7 @@ def test_get_proposal_id(
5753 # Test function
5854 result = get_proposal_id (
5955 proposal_code = ExampleVisit .proposal_code ,
60- proposal_number = ExampleVisit .proposal_number ,
56+ proposal_number = str ( ExampleVisit .proposal_number ) ,
6157 db = ispyb_db_session ,
6258 )
6359 assert proposal_id == result
@@ -71,35 +67,3 @@ def test_get_sub_samples_from_visit():
7167@mark .skip
7268def test_get_all_ongoing_visits ():
7369 pass
74-
75-
76- def test_get_data_collection_group_ids (
77- ispyb_db_session : Session ,
78- ):
79- # Get the BLSession ID from test database
80- bl_session_id = get_session_id (
81- microscope = ExampleVisit .instrument_name ,
82- proposal_code = ExampleVisit .proposal_code ,
83- proposal_number = str (ExampleVisit .proposal_number ),
84- visit_number = str (ExampleVisit .visit_number ),
85- db = ispyb_db_session ,
86- )
87-
88- # Add example data collections
89- dcgs = [
90- {
91- "sessionId" : bl_session_id ,
92- "experimentTypeId" : ISPyBTableValues .experiment_types .get (name ),
93- }
94- for name , id in ISPyBTableValues .experiment_types .items ()
95- ]
96- dcg_entries = [DataCollectionGroup (** dcg ) for dcg in dcgs ]
97- for entry in dcg_entries :
98- ispyb_db_session .add (entry )
99- ispyb_db_session .commit ()
100-
101- # Test the function
102- results = get_data_collection_group_ids (
103- session_id = bl_session_id ,
104- )
105- assert len (results ) == len (dcg_entries )
0 commit comments