MCPcopy Create free account
hub / github.com/driangle/taskmd / TestHandleConfig_ReadOnly

Function TestHandleConfig_ReadOnly

apps/cli/internal/web/handlers_test.go:707–726  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

705}
706
707func TestHandleConfig_ReadOnly(t *testing.T) {
708 cfg := Config{ReadOnly: true}
709
710 req := httptest.NewRequest(http.MethodGet, "/api/config", nil)
711 rec := httptest.NewRecorder()
712
713 handleConfig(cfg)(rec, req)
714
715 if rec.Code != http.StatusOK {
716 t.Fatalf("expected 200, got %d", rec.Code)
717 }
718
719 var resp ConfigResponse
720 if err := json.Unmarshal(rec.Body.Bytes(), &resp); err != nil {
721 t.Fatalf("invalid JSON: %v", err)
722 }
723 if !resp.ReadOnly {
724 t.Error("expected readonly to be true")
725 }
726}
727
728func TestHandleUpdateTask_ReadOnly(t *testing.T) {
729 dir := createTestTaskDir(t)

Callers

nothing calls this directly

Calls 2

handleConfigFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected