Files
CLIProxyAPI/sdk/cliproxy/auth/apply_patch_capability_test.go
Luis Pater 3ebee06516 fix(interactions): bridge apply_patch tool calls in responses translation
- Handle apply_patch custom tool call streaming deltas and snapshots for Responses API translation
- Track and resolve step indexes, function call identities, and error states across stream events
- Propagate apply_patch tool input errors and upstream failure states in stream and non-stream responses
2026-10-02 03:49:51 +08:00

35 lines
1.1 KiB
Go

package auth
import "testing"
type patchSupportExecutor struct {
*replaceAwareExecutor
supported bool
}
func (e *patchSupportExecutor) SupportsApplyPatch() bool { return e.supported }
func TestApplyPatchManagerAllCandidates(t *testing.T) {
m := NewManager(nil, nil, nil)
m.RegisterExecutor(&patchSupportExecutor{&replaceAwareExecutor{id: "custom-name"}, true})
m.RegisterExecutor(&patchSupportExecutor{&replaceAwareExecutor{id: "denied"}, false})
m.RegisterExecutor(&replaceAwareExecutor{id: "codex"})
for _, tc := range []struct {
providers []string
want bool
}{
{nil, false}, {[]string{"unknown"}, false}, {[]string{"codex"}, false},
{[]string{"custom-name"}, true}, {[]string{"custom-name", "custom-name"}, true},
{[]string{"custom-name", "denied"}, false}, {[]string{"custom-name", "unknown"}, false},
{[]string{"custom-name", "codex"}, false},
} {
if got := m.SupportsApplyPatchForProviders(tc.providers); got != tc.want {
t.Errorf("providers %v: got %v, want %v", tc.providers, got, tc.want)
}
}
var absent *Manager
if absent.SupportsApplyPatchForProviders([]string{"custom-name"}) {
t.Fatal("nil manager has capability")
}
}