File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99
1010from murfey .server .api .auth import (
1111 check_user ,
12+ get_visit_name ,
1213 submit_to_auth_endpoint ,
1314 validate_frontend_session_access ,
1415 validate_session_against_visit ,
1516 validate_token ,
1617 validate_user_instrument_access ,
1718)
1819from murfey .util .db import MurfeyUser , Session as MurfeySession
20+ from tests .conftest import ExampleVisit
1921
2022
2123@pytest .mark .parametrize (
@@ -316,8 +318,19 @@ async def test_validate_instrument_token():
316318 pass
317319
318320
319- def test_get_visit_name ():
320- pass
321+ def test_get_visit_name (
322+ mocker : MockerFixture ,
323+ murfey_db_session : SQLModelSession ,
324+ ):
325+ # Patch the Session call with the test database
326+ mock_session_context = MagicMock ()
327+ mock_session_context .__enter__ .return_value = murfey_db_session
328+ mock_session_context .__exit__ .return_value = None
329+ mocker .patch ("murfey.server.api.auth.Session" , return_value = mock_session_context )
330+
331+ # Check that the built-in default visit gets returned
332+ visit_name = f"{ ExampleVisit .proposal_code } { ExampleVisit .proposal_number } -{ ExampleVisit .visit_number } "
333+ assert get_visit_name (ExampleVisit .murfey_session_id ) == visit_name
321334
322335
323336@pytest .mark .asyncio
You can’t perform that action at this time.
0 commit comments