MAESTRO: add failing tests for tests endpoint

This commit is contained in:
Mariusz Banach
2026-02-18 00:58:44 +01:00
parent f523c4dcf5
commit 77c1881534
2 changed files with 71 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
from __future__ import annotations
import pytest
from httpx import ASGITransport, AsyncClient
from app.engine.scanner_registry import ScannerRegistry
from app.main import app
@pytest.mark.asyncio
async def test_get_tests_returns_all_registered_tests() -> None:
registry = ScannerRegistry()
expected = registry.list_tests()
expected_lookup = {test.id: test.name for test in expected}
async with AsyncClient(
transport=ASGITransport(app=app),
base_url="http://test",
) as client:
response = await client.get("/api/tests")
assert response.status_code == 200
payload = response.json()
assert isinstance(payload, list)
assert len(payload) == len(expected_lookup)
response_lookup = {item["id"]: item["name"] for item in payload}
assert len(response_lookup) == len(expected_lookup)
assert response_lookup == expected_lookup