"""Instance detail endpoint tests — Go/Gin backend.""" import pytest from httpx import AsyncClient from tests.conftest import auth_header class TestInstanceDetail: async def test_detail_databases(self, client: AsyncClient, admin_token: str, test_mysql_instance): inst = test_mysql_instance resp = await client.get( f"/api/v1/instances/{inst['id']}/detail/databases", headers=auth_header(admin_token), ) assert resp.status_code in (200, 500) # 500 if MySQL unreachable async def test_detail_processlist(self, client: AsyncClient, admin_token: str, test_mysql_instance): inst = test_mysql_instance resp = await client.get( f"/api/v1/instances/{inst['id']}/detail/processlist", headers=auth_header(admin_token), ) assert resp.status_code in (200, 500) # 500 if MySQL unreachable async def test_detail_status(self, client: AsyncClient, admin_token: str, test_mysql_instance): inst = test_mysql_instance resp = await client.get( f"/api/v1/instances/{inst['id']}/detail/status", headers=auth_header(admin_token), ) assert resp.status_code in (200, 500) # 500 if MySQL unreachable async def test_detail_users(self, client: AsyncClient, admin_token: str, test_mysql_instance): inst = test_mysql_instance resp = await client.get( f"/api/v1/instances/{inst['id']}/detail/users", headers=auth_header(admin_token), ) assert resp.status_code == 200 async def test_no_auth(self, client: AsyncClient): resp = await client.get("/api/v1/instances/4/detail/databases") assert resp.status_code == 401