@@ -301,6 +301,49 @@ async def test_start_computation(
301
301
),
302
302
)
303
303
assert response .status_code == status .HTTP_201_CREATED , response .text
304
+ mocked_get_service_resources = mocked_catalog_service_fcts ["get_service_resources" ]
305
+ # there should be as many calls to the catalog as there are no defined resources by default
306
+ assert mocked_get_service_resources .call_count == len (
307
+ fake_workbench_without_outputs
308
+ )
309
+
310
+
311
+ async def test_start_computation_with_project_node_resources_defined (
312
+ minimal_configuration : None ,
313
+ mocked_director_service_fcts ,
314
+ mocked_catalog_service_fcts ,
315
+ product_name : str ,
316
+ fake_workbench_without_outputs : dict [str , Any ],
317
+ registered_user : Callable [..., dict [str , Any ]],
318
+ project : Callable [..., Awaitable [ProjectAtDB ]],
319
+ async_client : httpx .AsyncClient ,
320
+ ):
321
+ user = registered_user ()
322
+ proj = await project (
323
+ user ,
324
+ project_nodes_overrides = {
325
+ "required_resources" : ServiceResourcesDictHelpers .Config .schema_extra [
326
+ "examples"
327
+ ][0 ]
328
+ },
329
+ workbench = fake_workbench_without_outputs ,
330
+ )
331
+ create_computation_url = httpx .URL ("/v2/computations" )
332
+ response = await async_client .post (
333
+ create_computation_url ,
334
+ json = jsonable_encoder (
335
+ ComputationCreate (
336
+ user_id = user ["id" ],
337
+ project_id = proj .uuid ,
338
+ start_pipeline = True ,
339
+ product_name = product_name ,
340
+ )
341
+ ),
342
+ )
343
+ assert response .status_code == status .HTTP_201_CREATED , response .text
344
+ mocked_get_service_resources = mocked_catalog_service_fcts ["get_service_resources" ]
345
+ # there should be no calls to the catalog as there are resources defined, so no need to call the catalog
346
+ assert mocked_get_service_resources .call_count == 0
304
347
305
348
306
349
async def test_start_computation_with_deprecated_services_raises_406 (
0 commit comments