forked from mystiq/dex
24 lines
470 B
Go
24 lines
470 B
Go
package server
|
|
|
|
import (
|
|
"net/http"
|
|
"net/http/httptest"
|
|
"testing"
|
|
|
|
"golang.org/x/net/context"
|
|
)
|
|
|
|
func TestHandleHealth(t *testing.T) {
|
|
ctx, cancel := context.WithCancel(context.Background())
|
|
defer cancel()
|
|
|
|
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)
|
|
}
|
|
|
|
}
|