Handle legacy Codex approval requests
This commit is contained in:
@@ -84,6 +84,34 @@ func TestApprovalResponseForPermissions(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestApprovalResponseForLegacyApproval(t *testing.T) {
|
||||
approval := store.PendingApproval{Kind: "execCommandApproval"}
|
||||
response, ok := approvalResponse(approval, "accept").(map[string]any)
|
||||
if !ok {
|
||||
t.Fatal("legacy response should be a map")
|
||||
}
|
||||
if response["decision"] != "approved" {
|
||||
t.Fatalf("legacy accept = %v, want approved", response["decision"])
|
||||
}
|
||||
response, ok = approvalResponse(approval, "decline").(map[string]any)
|
||||
if !ok {
|
||||
t.Fatal("legacy decline response should be a map")
|
||||
}
|
||||
if response["decision"] != "denied" {
|
||||
t.Fatalf("legacy decline = %v, want denied", response["decision"])
|
||||
}
|
||||
}
|
||||
|
||||
func TestRenderLegacyApprovalDetails(t *testing.T) {
|
||||
raw := json.RawMessage(`{"conversationId":"thr_1","callId":"call_1","command":["git","remote","-v"],"cwd":"/workspace/project","reason":"Need remote details"}`)
|
||||
text := renderApprovalHTML("execCommandApproval", raw, "")
|
||||
for _, want := range []string{"Codex requests command approval", "Need remote details", "language-bash", "git", "CWD"} {
|
||||
if !strings.Contains(text, want) {
|
||||
t.Fatalf("legacy approval render missing %q in %q", want, text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestEditReplyMarkupClearsInlineKeyboard(t *testing.T) {
|
||||
markup := editReplyMarkup(nil)
|
||||
if markup == nil {
|
||||
|
||||
Reference in New Issue
Block a user