优化
This commit is contained in:
@@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user