"""Integration: query execution test — Go/Gin backend.""" import pytest from httpx import AsyncClient from tests.conftest import auth_header class TestQueryExecute: async def test_execute_select(self, client: AsyncClient, admin_token: str, test_mysql_instance): resp = await client.post("/api/v1/query/execute", headers=auth_header(admin_token), json={ "instance_id": test_mysql_instance["id"], "database": "test", "sql": "SELECT 1 AS val", }) assert resp.status_code == 200 data = resp.json() # Should have columns and rows assert "columns" in data or "rows" in data or "data" in data async def test_no_auth(self, client: AsyncClient): resp = await client.post("/api/v1/query/execute", json={ "instance_id": 1, "database": "test", "sql": "SELECT 1", }) assert resp.status_code == 401