"""IT-RET-001 / IT-CMD-001 — retries queue and assets command logs."""

from __future__ import annotations

import pytest

from server.api.settings import list_retry_jobs

pytestmark = pytest.mark.integration


@pytest.mark.asyncio
async def test_list_retry_jobs(db_session, test_admin):
    jobs = await list_retry_jobs(limit=50, admin=test_admin["admin"], db=db_session)
    assert isinstance(jobs, list)


@pytest.mark.asyncio
async def test_assets_command_logs_paginated(db_session, test_admin):
    from server.api.assets import list_command_logs, list_ssh_sessions

    body = await list_command_logs(
        server_id=None,
        session_id=None,
        page=1,
        per_page=5,
        limit=5,
        offset=0,
        admin=test_admin["admin"],
        db=db_session,
    )
    assert "items" in body
    assert "total" in body
    assert body["page"] == 1
    assert body["per_page"] == 5

    sessions = await list_ssh_sessions(
        server_id=None,
        page=1,
        per_page=5,
        limit=5,
        offset=0,
        admin=test_admin["admin"],
        db=db_session,
    )
    assert "items" in sessions
    assert "total" in sessions
