feat: 实现 Sense 本地事件只读查看 (#73)
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth"
|
||||
)
|
||||
|
||||
func TestLocalEventRouterIsReadOnly(t *testing.T) {
|
||||
gin.SetMode(gin.TestMode)
|
||||
engine := gin.New()
|
||||
registerSenseLocalEventRouter(engine.Group("/api/v1"), &jwt.GinJWTMiddleware{})
|
||||
|
||||
routes := make(map[string]struct{})
|
||||
for _, route := range engine.Routes() {
|
||||
routes[route.Method+" "+route.Path] = struct{}{}
|
||||
}
|
||||
for _, expected := range []string{"GET /api/v1/local-events", "GET /api/v1/local-events/:id"} {
|
||||
if _, ok := routes[expected]; !ok {
|
||||
t.Fatalf("missing local event route: %s", expected)
|
||||
}
|
||||
}
|
||||
for route := range routes {
|
||||
if route != "GET /api/v1/local-events" && route != "GET /api/v1/local-events/:id" {
|
||||
t.Fatalf("unexpected mutable local event route: %s", route)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user