sync: migrate ai-operator to Gitea (2026-08-10)

This commit is contained in:
konturai-ops
2026-08-10 15:26:52 +00:00
commit 53652b95ad
173 changed files with 16676 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
package handoff
import "testing"
func TestPolicy(t *testing.T) {
d := Authorize(PolicyContext{State: "READY_TO_HELP", Route: "test", HandoffEnabled: false, HandoffMode: HandoffModeARIRedirect, AllowInTestRouteOnly: true, HasTarget: true})
if !d.Allowed || !d.StubOnly {
t.Fatalf("disabled must be stub only: %+v", d)
}
d = Authorize(PolicyContext{State: "READY_TO_HELP", Route: "test", HandoffEnabled: true, HandoffMode: HandoffModeARIRedirect, AllowInTestRouteOnly: true})
if !d.StubOnly || d.ReasonCode != "not_configured" {
t.Fatalf("missing target should stub: %+v", d)
}
d = Authorize(PolicyContext{State: "READY_TO_HELP", Route: "production", HandoffEnabled: true, HandoffMode: HandoffModeARIRedirect, AllowInTestRouteOnly: true, HasTarget: true})
if !d.StubOnly {
t.Fatalf("production should stub: %+v", d)
}
d = Authorize(PolicyContext{State: "ENDED", Route: "test", HandoffEnabled: true, HandoffMode: HandoffModeDisabledStub})
if d.Allowed {
t.Fatalf("ended should deny: %+v", d)
}
}