mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-08-15 19:24:23 +08:00
- 接入任务持久化、生命周期、调度运行与检查点管理 - 提供 ID 作用域元数据、能力解析、预检和生产审批接口 - 串联水位与 MongoDB CDC 执行、错误行隔离及安全重放
31 lines
868 B
Go
31 lines
868 B
Go
package app
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"GoNavi-Wails/internal/connection"
|
|
"GoNavi-Wails/internal/sync"
|
|
)
|
|
|
|
func TestEnsureDataSyncTargetProtectionRequiresDataEditAndImportPermission(t *testing.T) {
|
|
base := sync.SyncConfig{
|
|
TargetConfig: connection.ConnectionConfig{Type: "mysql"},
|
|
Content: "data",
|
|
}
|
|
if err := ensureDataSyncTargetProtection(base); err != nil {
|
|
t.Fatalf("unrestricted target rejected: %v", err)
|
|
}
|
|
|
|
dataEditBlocked := base
|
|
dataEditBlocked.TargetConfig.Protection.RestrictDataEdit = true
|
|
if err := ensureDataSyncTargetProtection(dataEditBlocked); err == nil {
|
|
t.Fatal("data sync bypassed restrictDataEdit")
|
|
}
|
|
|
|
dataImportBlocked := base
|
|
dataImportBlocked.TargetConfig.Protection.RestrictDataImport = true
|
|
if err := ensureDataSyncTargetProtection(dataImportBlocked); err == nil {
|
|
t.Fatal("data sync bypassed restrictDataImport")
|
|
}
|
|
}
|