INNER CODE UNIT · Go

TestNotifyFindingsSeverityFilter

vmfunc/sif · notify_test.go:51

func TestNotifyFindingsSeverityFilter(t *testing.T) {
	tests := []struct {
		name     string
		floor    string
		wantKeys []string
	}{
		{name: "medium drops info+low", floor: "medium", wantKeys: []string{"sql:e", "cors:c", "lfi:l"}},
		{name: "high drops everything below", floor: "high", wantKeys: []string{"cors:c", "lfi:l"}},
		{name: "info keeps all", floor: "info", wantKeys: []string{"headers:s", "redirect:r", "sql:e", "cors:c", "lfi:l"}},
		{name: "critical keeps only critical", floor: "critical", wantKeys: []string{"lfi:l"}},
		// an unrecognized floor must default to medium, not let info through.
		{name: "garbage floor defaults medium", floor: "bogus", wantKeys: []string{"sql:e", "cors:c", "lfi:l"}},
	}

	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			var got notifyWebhookBody
			srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…