import pytest

from app.modules.media.service import AvatarValidationError, validate_and_process_avatar
from tests.fixtures import make_test_png


def test_validate_rejects_empty():
    with pytest.raises(AvatarValidationError, match="INVALID_IMAGE"):
        validate_and_process_avatar(b"")


def test_validate_rejects_corrupt_bytes():
    with pytest.raises(AvatarValidationError, match="INVALID_IMAGE"):
        validate_and_process_avatar(b"not-an-image")
