Files
compute-engine/router/retired_frontend_routes_test.go
T

27 lines
731 B
Go
Raw Normal View History

package router
import (
"net/http"
"testing"
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
)
func TestRetiredFrontendAPIRoutes(t *testing.T) {
gin.SetMode(gin.TestMode)
engine := gin.New()
SetApiRouter(engine)
routes := make(map[string]struct{}, len(engine.Routes()))
for _, route := range engine.Routes() {
routes[route.Method+" "+route.Path] = struct{}{}
}
_, hasAsyncCleanup := routes[http.MethodPost+" /api/system-task/log-cleanup"]
_, hasDirectDelete := routes[http.MethodDelete+" /api/log/"]
_, hasConsoleMigration := routes[http.MethodPost+" /api/option/migrate_console_setting"]
assert.True(t, hasAsyncCleanup)
assert.False(t, hasDirectDelete)
assert.False(t, hasConsoleMigration)
}