This commit is contained in:
Yvan
2026-08-17 15:23:57 +08:00
parent 05b49cd86a
commit 083cc3a9ea
24 changed files with 639 additions and 287 deletions
+14
View File
@@ -112,3 +112,17 @@ func TestSetPolicyPathsUsesCompatibleDedupeKey(t *testing.T) {
t.Fatalf("deduplicated policies = %#v, want only the first concatenated-key match", rows)
}
}
func TestCheckPolicyStore(t *testing.T) {
data := newPolicyTestData(t)
repo := &apiRepo{data: data}
if err := repo.CheckPolicyStore(context.Background()); err != nil {
t.Fatalf("CheckPolicyStore returned error for migrated table: %v", err)
}
if err := data.gormDB.WithContext(context.Background()).Migrator().DropTable(&casbinRulePO{}); err != nil {
t.Fatal(err)
}
if err := repo.CheckPolicyStore(context.Background()); err == nil {
t.Fatal("CheckPolicyStore succeeded after casbin_rule was dropped")
}
}