File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717 validate_user_instrument_access ,
1818)
1919from murfey .util .db import MurfeyUser , Session as MurfeySession
20- from tests .conftest import ExampleVisit
2120
2221
2322@pytest .mark .parametrize (
@@ -322,15 +321,28 @@ def test_get_visit_name(
322321 mocker : MockerFixture ,
323322 murfey_db_session : SQLModelSession ,
324323):
324+ # Add a test visit to the database
325+ session_entry = MurfeySession (
326+ id = 11 ,
327+ name = "test_visit" ,
328+ visit = "test_visit" ,
329+ started = True ,
330+ current_gain_ref = "/path/to/gain_ref" ,
331+ instrument_name = "test_instrument" ,
332+ process = True ,
333+ visit_end_time = None ,
334+ )
335+ murfey_db_session .add (session_entry )
336+ murfey_db_session .commit ()
337+
325338 # Patch the Session call with the test database
326339 mock_session_context = MagicMock ()
327340 mock_session_context .__enter__ .return_value = murfey_db_session
328341 mock_session_context .__exit__ .return_value = None
329342 mocker .patch ("murfey.server.api.auth.Session" , return_value = mock_session_context )
330343
331344 # 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
345+ assert get_visit_name (session_id = 11 ) == "test_visit"
334346
335347
336348@pytest .mark .asyncio
You can’t perform that action at this time.
0 commit comments