crowdsec/pkg/apiserver/heartbeat_test.go
mmetc 06adbe031d
context propagation: apic, unit tests (#3271)
* context propagation: apic

* context propagation: unit tests
2024-10-03 14:51:53 +02:00

20 lines
434 B
Go

package apiserver
import (
"context"
"net/http"
"testing"
"github.com/stretchr/testify/assert"
)
func TestHeartBeat(t *testing.T) {
ctx := context.Background()
lapi := SetupLAPITest(t, ctx)
w := lapi.RecordResponse(t, ctx, http.MethodGet, "/v1/heartbeat", emptyBody, "password")
assert.Equal(t, 200, w.Code)
w = lapi.RecordResponse(t, ctx, "POST", "/v1/heartbeat", emptyBody, "password")
assert.Equal(t, 405, w.Code)
}