feat: move native communication to FFI (#1457)

This commit is contained in:
Levi authored and GitHub committed 2026-09-05 20:18:42 +08:00
1 parent 177c225f16
commit 39cd9034cd
86 files changed
+4558 -886

No files matched your search

+45
View File
@@ -0,0 +1,45 @@
package model
import "testing"
func TestStartConfigValidateWebAPIToken(t *testing.T) {
tests := []struct {
name string
config *StartConfig
wantErr bool
}{
{
name: "web API token without web auth",
config: &StartConfig{WebEnable: true, ApiToken: "token"},
wantErr: true,
},
{
name: "web API token with web auth",
config: &StartConfig{
WebEnable: true,
ApiToken: "token",
WebAuth: &WebAuth{
Username: "admin",
Password: "secret",
},
},
},
{
name: "web without authentication",
config: &StartConfig{WebEnable: true},
},
{
name: "native REST API token",
config: &StartConfig{NativeMode: true, ApiToken: "token"},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
err := tt.config.Validate()
if (err != nil) != tt.wantErr {
t.Fatalf("Validate() error = %v, wantErr %v", err, tt.wantErr)
}
})
}
}