maris-ai-master / core-python /tests /test_images.py
MarisUK's picture
Maris AI model sync
f440f03 verified
"""Tests attēlu ģenerēšanai."""
from unittest.mock import AsyncMock, patch
import pytest
from fastapi import HTTPException
from maris_core.images.generate_image import ImageRequest, generate_image
@pytest.mark.asyncio
async def test_generate_image_requires_explicit_maris_model() -> None:
"""Pārbauda, ka attēlu ģenerēšana neatgriež placeholder fallback."""
with (
patch(
"maris_core.utils.hf_integration.HFIntegration.save_generation",
new_callable=AsyncMock,
),
patch.dict("os.environ", {"IMAGE_MODEL": ""}, clear=False),
):
req = ImageRequest(prompt="zaļš mežs ar upi")
with pytest.raises(HTTPException) as exc_info:
await generate_image(req)
assert exc_info.value.status_code == 503