import pytest
from httpx import AsyncClient

from src.main import app


@pytest.fixture
async def async_client():
    async with AsyncClient(app=app, base_url="http://test") as client:
        yield client


@pytest.mark.asyncio
@pytest.mark.integration
async def test_create_ssh_key_requires_authentication(async_client: AsyncClient) -> None:
    response = await async_client.post("/ssh-keys", json={"name": "test-key"})
    assert response.status_code == 401


@pytest.mark.asyncio
@pytest.mark.integration
async def test_list_ssh_keys_requires_authentication(async_client: AsyncClient) -> None:
    response = await async_client.get("/ssh-keys")
    assert response.status_code == 401
