"""Tests for Config Profile refresh safety contracts."""

import uuid
from unittest.mock import AsyncMock

import pytest
from fastapi import HTTPException

from src.api.config.config_profiles import refresh_profile_git_mounts


@pytest.mark.unit
async def test_git_refresh_requires_destructive_confirmation() -> None:
    """The endpoint must not reset a writable working copy without consent."""
    with pytest.raises(HTTPException) as exc_info:
        await refresh_profile_git_mounts(
            profile_id=str(uuid.uuid4()),
            confirm_destructive_refresh=False,
            current_user_id=uuid.uuid4(),
            session=AsyncMock(),
        )

    assert exc_info.value.status_code == 409
