fix image generation provider settings

This commit is contained in:
ZegWe
2026-05-22 17:42:01 +08:00
committed by Xubin Ren
parent 65dff4f3a5
commit ffd85a8611
4 changed files with 34 additions and 3 deletions
+13
View File
@@ -624,6 +624,19 @@ async def test_openai_aspect_ratio_to_size() -> None:
assert fake.calls[0]["json"]["size"] == "1024x1024"
@pytest.mark.asyncio
async def test_openai_gpt_image_uses_supported_landscape_size() -> None:
fake = FakeClient(FakeResponse({"data": [{"b64_json": RAW_B64}]}))
client = OpenAIImageGenerationClient(
api_key="sk-openai-test",
client=fake, # type: ignore[arg-type]
)
await client.generate(prompt="draw", model="gpt-image-1", aspect_ratio="16:9")
assert fake.calls[0]["json"]["size"] == "1536x1024"
@pytest.mark.asyncio
async def test_openai_default_size_when_no_aspect_ratio() -> None:
fake = FakeClient(FakeResponse({"data": [{"b64_json": RAW_B64}]}))