File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22from sqlalchemy import select
33from sqlalchemy .orm import Session
44
5- from murfey .server .ispyb import get_session_id
5+ from murfey .server .ispyb import get_proposal_id , get_session_id
66from tests .conftest import ExampleVisit
77
88
@@ -33,3 +33,25 @@ def test_get_session_id(
3333 db = ispyb_db ,
3434 )
3535 assert query == result
36+
37+
38+ def test_get_proposal_id (
39+ ispyb_db : Session ,
40+ ):
41+ # Manually query the Proposal ID
42+ query = (
43+ ispyb_db .execute (
44+ select (Proposal )
45+ .where (Proposal .proposalCode == ExampleVisit .proposal_code )
46+ .where (Proposal .proposalNumber == ExampleVisit .proposal_number )
47+ )
48+ .scalar_one ()
49+ .proposalId
50+ )
51+
52+ # Test function
53+ result = get_proposal_id (
54+ proposal_code = ExampleVisit .proposal_code ,
55+ proposal_number = ExampleVisit .proposal_number ,
56+ )
57+ assert query == result
You can’t perform that action at this time.
0 commit comments