Files
descrybe/apps/api/internal/httpapi/mcp_removal_test.go
T
greeneclipse 8580c996c3 Initial commit of Descrybe v2 without local scratch artifacts.
Drop one-shot tmp/axe scripts and agent i18n scratch so the Gitea tree is deployable.
2026-08-09 22:47:43 +02:00

29 lines
845 B
Go

package httpapi
import (
"net/http"
"net/http/httptest"
"testing"
)
// TestRouterV1MCPInstallGone locks MCP removal: GET /api/v1/mcp/install.json
// must be absent from the public router (chi 404), not a live install snippet.
func TestRouterV1MCPInstallGone(t *testing.T) {
t.Parallel()
s := testAPIServer()
h := s.Router()
rec := httptest.NewRecorder()
h.ServeHTTP(rec, httptest.NewRequest(http.MethodGet, "/api/v1/mcp/install.json", nil))
if rec.Code != http.StatusNotFound {
t.Fatalf("mcp install status=%d want 404 body=%s", rec.Code, rec.Body.String())
}
// OpenAPI must remain public after MCP removal.
openAPI := httptest.NewRecorder()
h.ServeHTTP(openAPI, httptest.NewRequest(http.MethodGet, "/api/v1/openapi.yaml", nil))
if openAPI.Code != http.StatusOK {
t.Fatalf("openapi status=%d want 200", openAPI.Code)
}
}