import os import pytest from logimage.infrastructure.image.unsplash_source import UnsplashImageSource from logimage.domain.value_objects.image_data import ImageData @pytest.mark.integration def test_fetch_returns_image_data() -> None: api_key = os.environ.get("UNSPLASH_ACCESS_KEY") if not api_key: pytest.skip("UNSPLASH_ACCESS_KEY not set") source = UnsplashImageSource(api_key=api_key) result = source.fetch() assert isinstance(result, ImageData) assert len(result.content) > 1000 assert isinstance(result.title, str) @pytest.mark.integration def test_fetch_with_theme_returns_image_data() -> None: api_key = os.environ.get("UNSPLASH_ACCESS_KEY") if not api_key: pytest.skip("UNSPLASH_ACCESS_KEY not set") source = UnsplashImageSource(api_key=api_key) result = source.fetch(theme="forest") assert isinstance(result, ImageData) assert len(result.content) > 1000