Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

549 B
Raw Blame
package notifications

import (
	"strings"
	"testing"
)

func TestSendWebhookRequestRevalidatesURL(t *testing.T) {
	nm := NewNotificationManager("")
	defer nm.Stop()

	webhook := WebhookConfig{
		Name: "blocked",
		URL:  "http://127.0.0.1/webhook",
	}

	err := nm.sendWebhookRequest(webhook, []byte(`{}`), "alert", "test-alert:alert")
	if err == nil {
		t.Fatalf("expected validation error for localhost webhook URL")
	}
	if !strings.Contains(err.Error(), "webhook URL validation failed") {
		t.Fatalf("expected validation error, got %v", err)
	}
}