"""Tests for Excel sanity check service (sync Celery service).

Note: run_sanity_check opens a real synchronous DB connection, so the
meaningful tests are integration-only (marked accordingly). The unit-level
test only verifies the import and signature.
"""
import pytest


def test_run_sanity_check_importable():
    """run_sanity_check can be imported without errors."""
    from app.domains.imports.service import run_sanity_check
    assert callable(run_sanity_check)


@pytest.mark.integration
def test_run_sanity_check_missing_file_does_not_crash():
    """Sanity-check-Service gibt leeres Dict zurück bei nicht existierendem File (integration)."""
    from app.domains.imports.service import run_sanity_check
    import uuid
    import app.models  # noqa - register all models so SQLAlchemy relationships resolve
    result = run_sanity_check(
        validation_id=str(uuid.uuid4()),
        excel_path="/nonexistent/test.xlsx",
        tenant_id=None,
    )
    # Service returns {} when validation not found
    assert isinstance(result, dict)
