MCPcopy
hub / github.com/crowdsecurity/crowdsec / InsertAlertFromFile

Method InsertAlertFromFile

pkg/apiserver/alerts_test.go:53–56  ·  view source on GitHub ↗
(t *testing.T, ctx context.Context, path string)

Source from the content-addressed store, hash-verified

51}
52
53func (l *LAPI) InsertAlertFromFile(t *testing.T, ctx context.Context, path string) *httptest.ResponseRecorder {
54 alertReader := GetAlertReaderFromFile(t, path)
55 return l.RecordResponse(t, ctx, http.MethodPost, "/v1/alerts", alertReader, "password")
56}
57
58func (l *LAPI) RecordResponse(t *testing.T, ctx context.Context, verb string, url string, body *strings.Reader, authType string) *httptest.ResponseRecorder {
59 w := httptest.NewRecorder()

Callers 15

TestCreateAlertChannelsFunction · 0.95
TestDeleteDecisionRangeFunction · 0.80
TestDeleteDecisionFilterFunction · 0.80
TestGetDecisionFiltersFunction · 0.80
TestGetDecisionFunction · 0.80
TestDeleteDecisionByIDFunction · 0.80
TestDeleteDecisionFunction · 0.80
TestSimulatedAlertFunction · 0.80
TestCreateAlertFunction · 0.80

Calls 2

RecordResponseMethod · 0.95
GetAlertReaderFromFileFunction · 0.85

Tested by

no test coverage detected