mirror of
https://github.com/crowdsecurity/crowdsec.git
synced 2025-05-11 20:36:12 +02:00
support decisions deletion via scenario + alerts delete via ID (#1798)
This commit is contained in:
parent
24b540ecde
commit
ae6bf39495
10 changed files with 153 additions and 12 deletions
|
@ -61,6 +61,25 @@ func TestDeleteDecisionFilter(t *testing.T) {
|
|||
assert.Equal(t, `{"nbDeleted":"1"}`, w.Body.String())
|
||||
}
|
||||
|
||||
func TestDeleteDecisionFilterByScenario(t *testing.T) {
|
||||
lapi := SetupLAPITest(t)
|
||||
|
||||
// Create Valid Alert
|
||||
lapi.InsertAlertFromFile("./tests/alert_minibulk.json")
|
||||
|
||||
// delete by wrong scenario
|
||||
|
||||
w := lapi.RecordResponse("DELETE", "/v1/decisions?scenario=crowdsecurity/ssh-bff", emptyBody, PASSWORD)
|
||||
assert.Equal(t, 200, w.Code)
|
||||
assert.Equal(t, `{"nbDeleted":"0"}`, w.Body.String())
|
||||
|
||||
// delete by scenario good
|
||||
|
||||
w = lapi.RecordResponse("DELETE", "/v1/decisions?scenario=crowdsecurity/ssh-bf", emptyBody, PASSWORD)
|
||||
assert.Equal(t, 200, w.Code)
|
||||
assert.Equal(t, `{"nbDeleted":"2"}`, w.Body.String())
|
||||
}
|
||||
|
||||
func TestGetDecisionFilters(t *testing.T) {
|
||||
lapi := SetupLAPITest(t)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue