Skip to content

Commit cabec6f

Browse files
committed
Added unit test for 'get_proposal_id()' function
1 parent 8336fbd commit cabec6f

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

tests/server/test_ispyb.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from sqlalchemy import select
33
from 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
66
from 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

0 commit comments

Comments
 (0)