package api_test import ( "github.com/tradarr/backend/internal/api" "github.com/tradarr/backend/internal/api/handlers" "github.com/tradarr/backend/internal/config" "net/http" "net/http/httptest" "testing" ) func TestTicket43ModelGenerationTestRouteRequiresAuthentication(t *testing.T) { router := api.SetupRouter(handlers.New(nil, &config.Config{}, nil, nil, nil, nil), "fixture43") found := false for _, route := range router.Routes() { if route.Method == http.MethodPost && route.Path == "/api/admin/ai-models/:id/test" { found = true } } if !found { t.Fatal("model generation test route missing") } w := httptest.NewRecorder() router.ServeHTTP(w, httptest.NewRequest(http.MethodPost, "/api/admin/ai-models/00000000-0000-0000-0000-000000004301/test", nil)) if w.Code != 401 { t.Fatal("model generation test is not authenticated") } }