Files
podinfo/pkg/api/http/configs_test.go
Stefan Prodan 4920afdafb Improve test coverage of the HTTP API
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2026-05-20 11:07:35 +03:00

23 lines
506 B
Go

package http
import (
"net/http"
"net/http/httptest"
"strings"
"testing"
)
func TestConfigReadHandler(t *testing.T) {
srv := NewMockServer()
req, _ := http.NewRequest("GET", "/configs", nil)
rr := httptest.NewRecorder()
http.HandlerFunc(srv.configReadHandler).ServeHTTP(rr, req)
if rr.Code != http.StatusOK {
t.Fatalf("got status %d, want %d", rr.Code, http.StatusOK)
}
if !strings.Contains(rr.Body.String(), "{}") {
t.Errorf("expected empty JSON object, got: %s", rr.Body.String())
}
}