Co-authored-by: Kim-Adeline Miguel <51720070+kimadeline@users.noreply.github.com>
Co-authored-by: Mathias Gesbert <mathias.gesbert@mistral.ai>
Co-authored-by: Maxime Dolores <maxime.dolores@ext.mistral.ai>
Co-authored-by: Nelson PROIA <144663685+Nelson-PROIA@users.noreply.github.com>
Co-authored-by: Paul VEZIA <166131032+le-codeur-rapide@users.noreply.github.com>
Co-authored-by: Pierre Rossinès <pierre.rossines@mistral.ai>
Co-authored-by: Quentin <quentin.torroba@mistral.ai>
Co-authored-by: Val <102326092+vdeva@users.noreply.github.com>
Co-authored-by: Vincent G <10739306+VinceOPS@users.noreply.github.com>
Co-authored-by: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Guillaume LE GOFF 2026-06-12 13:16:04 +02:00 committed by GitHub
parent 702d0f412e
commit cafb6d4147
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
247 changed files with 12401 additions and 3029 deletions

View file

@ -174,9 +174,14 @@ async def test_start_raises_for_unsuccessful_response() -> None:
async with httpx.AsyncClient(transport=httpx.MockTransport(handler)) as client:
nuage = NuageClient("https://chat.example.com", "api-key", client=client)
with pytest.raises(ServiceTeleportError, match="Nuage start"):
with pytest.raises(ServiceTeleportError, match="status 401") as exc_info:
await nuage.start(_request())
assert exc_info.value.telemetry_details == {
"failure_kind": "http_error",
"http_status_code": 401,
}
@pytest.mark.asyncio
async def test_start_raises_for_invalid_response() -> None:
@ -185,5 +190,30 @@ async def test_start_raises_for_invalid_response() -> None:
async with httpx.AsyncClient(transport=httpx.MockTransport(handler)) as client:
nuage = NuageClient("https://chat.example.com", "api-key", client=client)
with pytest.raises(ServiceTeleportError, match="response was invalid"):
with pytest.raises(
ServiceTeleportError, match="response was invalid"
) as exc_info:
await nuage.start(_request())
assert exc_info.value.telemetry_details == {
"failure_kind": "invalid_schema",
"http_status_code": 200,
}
@pytest.mark.asyncio
async def test_start_raises_for_invalid_json_response() -> None:
async def handler(request: httpx.Request) -> httpx.Response:
return httpx.Response(
200, text="not-json", headers={"content-type": "text/plain"}
)
async with httpx.AsyncClient(transport=httpx.MockTransport(handler)) as client:
nuage = NuageClient("https://chat.example.com", "api-key", client=client)
with pytest.raises(ServiceTeleportError, match="not valid JSON") as exc_info:
await nuage.start(_request())
assert exc_info.value.telemetry_details == {
"failure_kind": "invalid_json",
"http_status_code": 200,
}