88import httpx
99from fastapi import status
1010from fixtures .fake_services import ServiceInRegistryInfoDict
11+ from pytest_simcore .helpers .typing_env import EnvVarsDict
1112
1213
1314def _assert_response_and_unwrap_envelope (got : httpx .Response ):
14- assert got .encoding == "application/json"
15+ assert got .headers ["content-type" ] == "application/json"
16+ assert got .encoding == "utf-8"
1517
1618 body = got .json ()
1719 assert isinstance (body , dict )
@@ -20,12 +22,14 @@ def _assert_response_and_unwrap_envelope(got: httpx.Response):
2022
2123
2224async def test_get_services_extras_by_key_and_version_with_empty_registry (
23- client : httpx .AsyncClient , api_version_prefix : str
25+ configure_registry_access : EnvVarsDict ,
26+ client : httpx .AsyncClient ,
27+ api_version_prefix : str ,
2428):
2529 resp = await client .get (
2630 f"/{ api_version_prefix } /service_extras/whatever/someversion"
2731 )
28- assert resp .status_code == status .HTTP_400_BAD_REQUEST , f"Got f{ resp .text } "
32+ assert resp .status_code == status .HTTP_422_UNPROCESSABLE_ENTITY , f"Got f{ resp .text } "
2933 resp = await client .get (
3034 f"/{ api_version_prefix } /service_extras/simcore/services/dynamic/something/someversion"
3135 )
@@ -37,6 +41,7 @@ async def test_get_services_extras_by_key_and_version_with_empty_registry(
3741
3842
3943async def test_get_services_extras_by_key_and_version (
44+ configure_registry_access : EnvVarsDict ,
4045 client : httpx .AsyncClient ,
4146 created_services : list [ServiceInRegistryInfoDict ],
4247 api_version_prefix : str ,
@@ -54,6 +59,6 @@ async def test_get_services_extras_by_key_and_version(
5459
5560 assert resp .status_code == status .HTTP_200_OK , f"Got { resp .text = } "
5661
57- service_extras , error = _assert_response_and_unwrap_envelope (resp . json () )
62+ service_extras , error = _assert_response_and_unwrap_envelope (resp )
5863 assert not error
5964 assert created_service ["service_extras" ] == service_extras
0 commit comments