Skip to content

Commit c195855

Browse files
committed
fix test failure
1 parent e8924b5 commit c195855

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

platform-api/internal/handler/llm_template_integration_test.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ func TestLLMTemplateHTTP_BlankGroupIDQuery(t *testing.T) {
332332
}
333333
}
334334

335-
// ---- PATCH enable/disable by handle (built-in only) -----------------------
335+
// ---- PATCH enable/disable by handle (built-in and custom) -----------------
336336

337337
func TestLLMTemplateHTTP_ToggleByHandle(t *testing.T) {
338338
r, _, cleanup := setupLLMTemplateEnv(t)
@@ -350,10 +350,16 @@ func TestLLMTemplateHTTP_ToggleByHandle(t *testing.T) {
350350
t.Errorf("re-enable built-in: expected 200, got %d", w.Code)
351351
}
352352

353-
// Custom template cannot be toggled -> 403.
353+
// Custom templates are toggleable too.
354354
handle, _ := createFamily(t, r, "Custom Toggle")
355-
if w := doJSON(t, r, http.MethodPatch, tmplBase+"/"+handle, `{"enabled":false}`, true); w.Code != http.StatusForbidden {
356-
t.Errorf("toggle custom: expected 403, got %d: %s", w.Code, w.Body.String())
355+
w = doJSON(t, r, http.MethodPatch, tmplBase+"/"+handle, `{"enabled":false}`, true)
356+
if w.Code != http.StatusOK {
357+
t.Errorf("disable custom: expected 200, got %d: %s", w.Code, w.Body.String())
358+
} else if bodyMap(t, w)["enabled"] != false {
359+
t.Errorf("expected enabled=false after disabling custom template")
360+
}
361+
if w := doJSON(t, r, http.MethodPatch, tmplBase+"/"+handle, `{"enabled":true}`, true); w.Code != http.StatusOK {
362+
t.Errorf("re-enable custom: expected 200, got %d: %s", w.Code, w.Body.String())
357363
}
358364

359365
// Unknown handle -> 404.

0 commit comments

Comments
 (0)