Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
matusdrobuliak66 committed Dec 3, 2024
1 parent 658b167 commit eabeafb
Showing 1 changed file with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
)
Expand Down

0 comments on commit eabeafb

Please sign in to comment.