dex/server/handlers_test.go

24 lines
452 B
Go
Raw Normal View History

2016-07-26 01:30:28 +05:30
package server
import (
"context"
"net/http"
"net/http/httptest"
"testing"
)
func TestHandleHealth(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
2016-10-14 06:45:20 +05:30
httpServer, server := newTestServer(ctx, t, nil)
defer httpServer.Close()
rr := httptest.NewRecorder()
server.handleHealth(rr, httptest.NewRequest("GET", "/healthz", nil))
if rr.Code != http.StatusOK {
t.Errorf("expected 200 got %d", rr.Code)
}
}