mirror of
https://github.com/pomerium/pomerium.git
synced 2025-04-29 18:36:30 +02:00
* proxy: add userinfo and webauthn endpoints * use TLD for RP id * use EffectiveTLDPlusOne * upgrade webauthn * fix test * Update internal/handlers/jwks.go Co-authored-by: bobby <1544881+desimone@users.noreply.github.com> Co-authored-by: bobby <1544881+desimone@users.noreply.github.com>
36 lines
864 B
Go
36 lines
864 B
Go
package handlers
|
|
|
|
import (
|
|
"net/http"
|
|
"net/http/httptest"
|
|
"testing"
|
|
)
|
|
|
|
func TestHealthCheck(t *testing.T) {
|
|
t.Parallel()
|
|
tests := []struct {
|
|
name string
|
|
method string
|
|
|
|
wantStatus int
|
|
}{
|
|
{"good - Get", http.MethodGet, http.StatusOK},
|
|
{"good - Head", http.MethodHead, http.StatusOK},
|
|
{"bad - Options", http.MethodOptions, http.StatusMethodNotAllowed},
|
|
{"bad - Put", http.MethodPut, http.StatusMethodNotAllowed},
|
|
{"bad - Post", http.MethodPost, http.StatusMethodNotAllowed},
|
|
{"bad - route miss", http.MethodGet, http.StatusOK},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
r := httptest.NewRequest(tt.method, "/", nil)
|
|
w := httptest.NewRecorder()
|
|
|
|
HealthCheck(w, r)
|
|
if w.Code != tt.wantStatus {
|
|
t.Errorf("code differs. got %d want %d body: %s", w.Code, tt.wantStatus, w.Body.String())
|
|
}
|
|
})
|
|
}
|
|
}
|