From eabeafb20daf8d3e2f01c2ed76abe97065767c48 Mon Sep 17 00:00:00 2001 From: matusdrobuliak66 Date: Tue, 3 Dec 2024 14:00:03 +0100 Subject: [PATCH] fix --- .../test_api_route_computations.py | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/services/director-v2/tests/unit/with_dbs/comp_scheduler/test_api_route_computations.py b/services/director-v2/tests/unit/with_dbs/comp_scheduler/test_api_route_computations.py index 4381c9311d4..6b6084c5895 100644 --- a/services/director-v2/tests/unit/with_dbs/comp_scheduler/test_api_route_computations.py +++ b/services/director-v2/tests/unit/with_dbs/comp_scheduler/test_api_route_computations.py @@ -186,15 +186,29 @@ def _mocked_service_resources(request) -> httpx.Response: def _mocked_services_details( request, service_key: str, service_version: str ) -> httpx.Response: + assert "json_schema_extra" in ServiceGet.model_config + assert isinstance(ServiceGet.model_config["json_schema_extra"], dict) + assert isinstance( + ServiceGet.model_config["json_schema_extra"]["examples"], list + ) + assert isinstance( + ServiceGet.model_config["json_schema_extra"]["examples"][0], dict + ) + data_published = fake_service_details.model_copy( + update={ + "key": urllib.parse.unquote(service_key), + "version": service_version, + } + ).model_dump(by_alias=True) + data = { + **ServiceGet.model_config["json_schema_extra"]["examples"][0], + **data_published, + } + payload = ServiceGet.model_validate(data) return httpx.Response( 200, json=jsonable_encoder( - fake_service_details.model_copy( - update={ - "key": urllib.parse.unquote(service_key), - "version": service_version, - } - ), + payload, by_alias=True, ), )