test(streaming): assert queued first-error JSON response (#51849)

Co-authored-by: mateo <277851410+mateo-berri@users.noreply.github.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
devin-ai-integration[bot] 2026-11-14 19:12:33 +00:00 • committed by GitHub
parent 8fc6789295
commit 969386fb73
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -451,10 +451,11 @@ def test_failure_hook_replacement_ends_a_queue_stream_that_fails_before_the_firs
marker: Final = _marker()
body: Final = _body("clean", marker, (_RAISING,), "raise-builtin-after-0", _REPLACE, priority=0)
response: Final = rig.proxy.gateway.request("POST", "/queue/chat/completions", body)
ended: Final = _ended_in_band(response, 200)
assert ended.content == "", response.text
assert ended.error["code"] == "403", ended.error
assert ended.error["message"] == _REPLACEMENT_MESSAGE, ended.error
assert response.status_code == 403, response.text
assert response.headers["content-type"] == "application/json", response.headers
assert JSON_OBJECT.validate_json(response.content) == {
"error": {"message": _REPLACEMENT_MESSAGE, "type": "permission_error", "param": None, "code": "403"}
}, response.text
assert _CRASH_MESSAGE not in response.text, response.text
assert _calls_with(rig.upstream, marker) == 1