feat: 重建 ONVIF 与 RTSP 视频接入 (#66)

This commit is contained in:
QiuSW
2026-08-14 16:50:00 +08:00
parent 5856b76de9
commit 2bb1614a3c
25 changed files with 1531 additions and 1 deletions
@@ -0,0 +1,21 @@
package admission
import (
"net/http/httptest"
"strings"
"testing"
"github.com/gin-gonic/gin"
)
func TestProbePayloadRejectsCredentialFields(t *testing.T) {
gin.SetMode(gin.TestMode)
recorder := httptest.NewRecorder()
ctx, _ := gin.CreateTestContext(recorder)
ctx.Request = httptest.NewRequest("POST", "/api/v1/admission/devices/device/probe", strings.NewReader(`{"address":"http://192.0.2.10/onvif","version":1,"password":"must-not-be-accepted"}`))
ctx.Request.Header.Set("Content-Type", "application/json")
var request ProbeRequest
if err := bindStrict(ctx, &request); err == nil {
t.Fatal("credential-like unknown field accepted")
}
}