mirror of
https://github.com/stefanprodan/podinfo.git
synced 2026-05-23 09:52:46 +00:00
23 lines
506 B
Go
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())
|
|
}
|
|
}
|