Skip to content

Commit eabeafb

Browse files
fix
1 parent 658b167 commit eabeafb

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

services/director-v2/tests/unit/with_dbs/comp_scheduler/test_api_route_computations.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,15 +186,29 @@ def _mocked_service_resources(request) -> httpx.Response:
186186
def _mocked_services_details(
187187
request, service_key: str, service_version: str
188188
) -> httpx.Response:
189+
assert "json_schema_extra" in ServiceGet.model_config
190+
assert isinstance(ServiceGet.model_config["json_schema_extra"], dict)
191+
assert isinstance(
192+
ServiceGet.model_config["json_schema_extra"]["examples"], list
193+
)
194+
assert isinstance(
195+
ServiceGet.model_config["json_schema_extra"]["examples"][0], dict
196+
)
197+
data_published = fake_service_details.model_copy(
198+
update={
199+
"key": urllib.parse.unquote(service_key),
200+
"version": service_version,
201+
}
202+
).model_dump(by_alias=True)
203+
data = {
204+
**ServiceGet.model_config["json_schema_extra"]["examples"][0],
205+
**data_published,
206+
}
207+
payload = ServiceGet.model_validate(data)
189208
return httpx.Response(
190209
200,
191210
json=jsonable_encoder(
192-
fake_service_details.model_copy(
193-
update={
194-
"key": urllib.parse.unquote(service_key),
195-
"version": service_version,
196-
}
197-
),
211+
payload,
198212
by_alias=True,
199213
),
200214
)

0 commit comments

Comments
 (0)