@@ -389,6 +389,54 @@ async def test_list_computation_collection_runs_with_client_defined_name(
389389 assert data [0 ]["name" ] == "My Collection Run"
390390
391391
392+ @pytest .mark .parametrize (* standard_role_response (), ids = str )
393+ async def test_list_computation_collection_runs_with_filter_only_running (
394+ director_v2_service_mock : AioResponsesMock ,
395+ user_project : ProjectDict ,
396+ client : TestClient ,
397+ logged_user : LoggedUser ,
398+ user_role : UserRole ,
399+ expected : ExpectedResponse ,
400+ populated_comp_run_collection : None ,
401+ mock_rpc_list_computation_collection_runs_page : None ,
402+ ):
403+ assert client .app
404+ url = client .app .router ["list_computation_collection_runs" ].url_for ()
405+ query_parameters = {"filter_only_running" : "true" }
406+ url_with_query = url .with_query (** query_parameters )
407+ resp = await client .get (f"{ url_with_query } " )
408+ data , _ = await assert_status (
409+ resp , status .HTTP_200_OK if user_role == UserRole .GUEST else expected .ok
410+ )
411+ if user_role != UserRole .ANONYMOUS :
412+ assert ComputationCollectionRunRestGet .model_validate (data [0 ])
413+ assert data [0 ]["name" ] == "My Collection Run"
414+
415+
416+ @pytest .mark .parametrize (* standard_role_response (), ids = str )
417+ async def test_list_computation_collection_runs_with_filter_root_project (
418+ director_v2_service_mock : AioResponsesMock ,
419+ user_project : ProjectDict ,
420+ client : TestClient ,
421+ logged_user : LoggedUser ,
422+ user_role : UserRole ,
423+ expected : ExpectedResponse ,
424+ populated_comp_run_collection : None ,
425+ mock_rpc_list_computation_collection_runs_page : None ,
426+ ):
427+ assert client .app
428+ url = client .app .router ["list_computation_collection_runs" ].url_for ()
429+ query_parameters = {"filter_by_root_project_id" : user_project ["uuid" ]}
430+ url_with_query = url .with_query (** query_parameters )
431+ resp = await client .get (f"{ url_with_query } " )
432+ data , _ = await assert_status (
433+ resp , status .HTTP_200_OK if user_role == UserRole .GUEST else expected .ok
434+ )
435+ if user_role != UserRole .ANONYMOUS :
436+ assert ComputationCollectionRunRestGet .model_validate (data [0 ])
437+ assert data [0 ]["name" ] == "My Collection Run"
438+
439+
392440@pytest .fixture
393441async def populated_project_metadata (
394442 client : TestClient ,
@@ -412,7 +460,7 @@ async def populated_project_metadata(
412460
413461
414462@pytest .mark .parametrize (* standard_role_response (), ids = str )
415- async def test_list_computation_collection_runs_and_tasks_with_different_names (
463+ async def test_list_computation_collection_runs_tasks_with_different_names (
416464 director_v2_service_mock : AioResponsesMock ,
417465 user_project : ProjectDict ,
418466 client : TestClient ,
0 commit comments