INNER CODE UNIT · Go

TestNotifyFindingsBelowFloorIsNoop

vmfunc/sif · notify_test.go:107

func TestNotifyFindingsBelowFloorIsNoop(t *testing.T) {
	// every finding below the floor -> nothing crosses -> no POST at all.
	hit := false
	srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
		hit = true
		w.WriteHeader(http.StatusOK)
	}))
	t.Cleanup(srv.Close)

	t.Setenv("SLACK_WEBHOOK_URL", "")
	t.Setenv("DISCORD_WEBHOOK_URL", "")
	t.Setenv("TELEGRAM_BOT_TOKEN", "")
	t.Setenv("TELEGRAM_CHAT_ID", "")
	t.Setenv("NOTIFY_WEBHOOK_URL", srv.URL)

	app := &App{settings: &config.Settings{
		Notify:         true,
		NotifySeverity: "critical",

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…