test(api): cover remote image URL rejection
This commit is contained in:
@@ -316,6 +316,32 @@ async def test_multimodal_content_extracts_text(aiohttp_client, mock_agent) -> N
|
|||||||
assert len(call_kwargs.get("media") or []) >= 0 # base64 images saved to disk
|
assert len(call_kwargs.get("media") or []) >= 0 # base64 images saved to disk
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(not HAS_AIOHTTP, reason="aiohttp not installed")
|
||||||
|
@pytest.mark.asyncio
|
||||||
|
async def test_multimodal_remote_image_url_returns_400(aiohttp_client, mock_agent) -> None:
|
||||||
|
app = create_app(mock_agent, model_name="m")
|
||||||
|
client = await aiohttp_client(app)
|
||||||
|
resp = await client.post(
|
||||||
|
"/v1/chat/completions",
|
||||||
|
json={
|
||||||
|
"messages": [
|
||||||
|
{
|
||||||
|
"role": "user",
|
||||||
|
"content": [
|
||||||
|
{"type": "text", "text": "describe this"},
|
||||||
|
{"type": "image_url", "image_url": {"url": "https://example.com/image.png"}},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
assert resp.status == 400
|
||||||
|
body = await resp.json()
|
||||||
|
assert "remote image urls are not supported" in body["error"]["message"].lower()
|
||||||
|
mock_agent.process_direct.assert_not_called()
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(not HAS_AIOHTTP, reason="aiohttp not installed")
|
@pytest.mark.skipif(not HAS_AIOHTTP, reason="aiohttp not installed")
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_empty_response_retry_then_success(aiohttp_client) -> None:
|
async def test_empty_response_retry_then_success(aiohttp_client) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user