29 lines
845 B
Go
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)
|
||
|
|
}
|
||
|
|
}
|