mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-09-10 22:20:25 +00:00
feat(task): replace built-in task adaptors with a sandboxed JS plugin system (#7076)
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sort"
|
||||
"testing"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestHostProtocolRegistryDrivesProtocolRoutesOnce(t *testing.T) {
|
||||
engine := gin.New()
|
||||
SetTaskPluginProtocolRouter(engine)
|
||||
|
||||
expected := []string{
|
||||
"POST /v1/responses",
|
||||
"GET /v1/responses/:response_id",
|
||||
"POST /v1/videos",
|
||||
"GET /v1/videos/:task_id",
|
||||
"GET /v1/videos/:task_id/content",
|
||||
"HEAD /v1/videos/:task_id/content",
|
||||
}
|
||||
actual := make([]string, 0, len(engine.Routes()))
|
||||
for _, route := range engine.Routes() {
|
||||
actual = append(actual, fmt.Sprintf("%s %s", route.Method, route.Path))
|
||||
}
|
||||
sort.Strings(expected)
|
||||
sort.Strings(actual)
|
||||
assert.Equal(t, expected, actual)
|
||||
}
|
||||
Reference in New Issue
Block a user