File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed
Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ from ispyb .sqlalchemy import BLSession , Person , Proposal
2+
3+ from murfey .server .ispyb import get_session_id
4+
5+
6+ def test_get_session_id (
7+ ispyb_session ,
8+ ):
9+
10+ # Create some values to put into BLSession and Proposal
11+ # 'Person' is a required table
12+ person_db_entry = Person (
13+ login = "murfey" ,
14+ )
15+ ispyb_session .add (person_db_entry )
16+ ispyb_session .commit ()
17+
18+ proposal_db_entry = Proposal (
19+ personId = Person .personId ,
20+ proposalCode = "cm" ,
21+ proposalNumber = "12345" ,
22+ )
23+ ispyb_session .add (proposal_db_entry )
24+ ispyb_session .commit ()
25+
26+ bl_session_db_entry = BLSession (
27+ proposalId = proposal_db_entry .proposalId ,
28+ beamLineName = "murfey" ,
29+ visit_number = 6 ,
30+ )
31+ ispyb_session .add (bl_session_db_entry )
32+ ispyb_session .commit ()
33+
34+ # Test function
35+ result = get_session_id (
36+ microscope = "murfey" ,
37+ proposal_code = "cm" ,
38+ proposal_number = "12345" ,
39+ visit_number = "6" ,
40+ db = ispyb_session ,
41+ )
42+ assert result == bl_session_db_entry .sessionId
You can’t perform that action at this time.
0 commit comments