feat(ai): test saved summary model generation (#43)
This commit is contained in:
28
backend/internal/api/model_generation_test_ticket43_test.go
Normal file
28
backend/internal/api/model_generation_test_ticket43_test.go
Normal file
@ -0,0 +1,28 @@
|
||||
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")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user