25 lines
365 B
Go
25 lines
365 B
Go
|
|
package service
|
||
|
|
|
||
|
|
import (
|
||
|
|
"net/http"
|
||
|
|
"net/http/httptest"
|
||
|
|
"testing"
|
||
|
|
)
|
||
|
|
|
||
|
|
func TestStatusHandler(t *testing.T) {
|
||
|
|
svc := &Service{}
|
||
|
|
|
||
|
|
req := httptest.NewRequest(http.MethodGet, "/status", nil)
|
||
|
|
w := httptest.NewRecorder()
|
||
|
|
|
||
|
|
svc.status(w, req)
|
||
|
|
|
||
|
|
if w.Code != http.StatusOK {
|
||
|
|
t.Errorf(
|
||
|
|
"status handler returned %d, want %d",
|
||
|
|
w.Code,
|
||
|
|
http.StatusOK,
|
||
|
|
)
|
||
|
|
}
|
||
|
|
}
|