@@ -393,11 +393,41 @@ def mocked_director_service_api_base(
393393 yield respx_mock
394394
395395
396+ @pytest .fixture
397+ def get_mocked_service_labels () -> Callable [[str , str ], dict ]:
398+ def _ (service_key : str , service_version : str ) -> dict :
399+ return {
400+ "io.simcore.authors" :
'{"authors": [{"name": "John Smith", "email": "[email protected] ", "affiliation": "ACME\' IS Foundation"}]}' ,
401+ "io.simcore.contact" :
'{"contact": "[email protected] "}' ,
402+ "io.simcore.description" : '{"description": "Autonomous Nervous System Network model"}' ,
403+ "io.simcore.inputs" : '{"inputs": {"input_1": {"displayOrder": 1.0, "label": "Simulation time", "description": "Duration of the simulation", "type": "ref_contentSchema", "contentSchema": {"type": "number", "x_unit": "milli-second"}, "defaultValue": 2.0}}}' ,
404+ "io.simcore.integration-version" : '{"integration-version": "1.0.0"}' ,
405+ "io.simcore.key" : '{"key": "xxxxx"}' .replace ("xxxxx" , service_key ),
406+ "io.simcore.name" : '{"name": "Autonomous Nervous System Network model"}' ,
407+ "io.simcore.outputs" : '{"outputs": {"output_1": {"displayOrder": 1.0, "label": "ANS output", "description": "Output of simulation of Autonomous Nervous System Network model", "type": "data:*/*", "fileToKeyMap": {"ANS_output.txt": "output_1"}}, "output_2": {"displayOrder": 2.0, "label": "Stimulation parameters", "description": "stim_param.txt file containing the input provided in the inputs port", "type": "data:*/*", "fileToKeyMap": {"ANS_stim_param.txt": "output_2"}}}}' ,
408+ "io.simcore.thumbnail" : '{"thumbnail": "https://www.statnews.com/wp-content/uploads/2020/05/3D-rat-heart.-iScience--768x432.png"}' ,
409+ "io.simcore.type" : '{"type": "computational"}' ,
410+ "io.simcore.version" : '{"version": "xxxxx"}' .replace (
411+ "xxxxx" , service_version
412+ ),
413+ "maintainer" : "johnsmith" ,
414+ "org.label-schema.build-date" : "2023-04-17T08:04:15Z" ,
415+ "org.label-schema.schema-version" : "1.0" ,
416+ "org.label-schema.vcs-ref" : "" ,
417+ "org.label-schema.vcs-url" : "" ,
418+ "simcore.service.restart-policy" : "no-restart" ,
419+ "simcore.service.settings" : '[{"name": "Resources", "type": "Resources", "value": {"Limits": {"NanoCPUs": 4000000000, "MemoryBytes": 2147483648}, "Reservations": {"NanoCPUs": 4000000000, "MemoryBytes": 2147483648}}}]' ,
420+ }
421+
422+ return _
423+
424+
396425@pytest .fixture
397426def mocked_director_service_api (
398427 mocked_director_service_api_base : respx .MockRouter ,
399428 director_service_openapi_specs : dict [str , Any ],
400429 expected_director_list_services : list [dict [str , Any ]],
430+ get_mocked_service_labels : Callable [[str , str ], dict ],
401431) -> respx .MockRouter :
402432 """
403433 STANDARD fixture to mock director service API
@@ -461,30 +491,7 @@ def _get_service_labels(request, service_key, service_version):
461491 return httpx .Response (
462492 status_code = status .HTTP_200_OK ,
463493 json = {
464- "data" : {
465- "io.simcore.authors" :
'{"authors": [{"name": "John Smith", "email": "[email protected] ", "affiliation": "ACME\' IS Foundation"}]}' ,
466- "io.simcore.contact" :
'{"contact": "[email protected] "}' ,
467- "io.simcore.description" : '{"description": "Autonomous Nervous System Network model"}' ,
468- "io.simcore.inputs" : '{"inputs": {"input_1": {"displayOrder": 1.0, "label": "Simulation time", "description": "Duration of the simulation", "type": "ref_contentSchema", "contentSchema": {"type": "number", "x_unit": "milli-second"}, "defaultValue": 2.0}}}' ,
469- "io.simcore.integration-version" : '{"integration-version": "1.0.0"}' ,
470- "io.simcore.key" : '{"key": "xxxxx"}' .replace (
471- "xxxxx" , found ["key" ]
472- ),
473- "io.simcore.name" : '{"name": "Autonomous Nervous System Network model"}' ,
474- "io.simcore.outputs" : '{"outputs": {"output_1": {"displayOrder": 1.0, "label": "ANS output", "description": "Output of simulation of Autonomous Nervous System Network model", "type": "data:*/*", "fileToKeyMap": {"ANS_output.txt": "output_1"}}, "output_2": {"displayOrder": 2.0, "label": "Stimulation parameters", "description": "stim_param.txt file containing the input provided in the inputs port", "type": "data:*/*", "fileToKeyMap": {"ANS_stim_param.txt": "output_2"}}}}' ,
475- "io.simcore.thumbnail" : '{"thumbnail": "https://www.statnews.com/wp-content/uploads/2020/05/3D-rat-heart.-iScience--768x432.png"}' ,
476- "io.simcore.type" : '{"type": "computational"}' ,
477- "io.simcore.version" : '{"version": "xxxxx"}' .replace (
478- "xxxxx" , found ["version" ]
479- ),
480- "maintainer" : "iavarone" ,
481- "org.label-schema.build-date" : "2023-04-17T08:04:15Z" ,
482- "org.label-schema.schema-version" : "1.0" ,
483- "org.label-schema.vcs-ref" : "" ,
484- "org.label-schema.vcs-url" : "" ,
485- "simcore.service.restart-policy" : "no-restart" ,
486- "simcore.service.settings" : '[{"name": "Resources", "type": "Resources", "value": {"Limits": {"NanoCPUs": 4000000000, "MemoryBytes": 2147483648}, "Reservations": {"NanoCPUs": 4000000000, "MemoryBytes": 2147483648}}}]' ,
487- }
494+ "data" : get_mocked_service_labels (found ["key" ], found ["version" ])
488495 },
489496 )
490497 return httpx .Response (
0 commit comments