Files
dockwatch/internal/notify/notify_test.go
T
jbergner 45ca18b74e
release-tag / release-image (push) Failing after 1m20s
init
2026-08-31 17:09:21 +02:00

25 lines
669 B
Go

package notify
import (
"strings"
"testing"
)
func TestConfigSecretsEncryptedAtRest(t *testing.T) {
s := New(nil, []byte("0123456789abcdef0123456789abcdef"))
raw, err := s.encodeConfig(map[string]string{"url": "https://example.invalid/hook", "token": "super-secret-token", "password": "pw123"})
if err != nil {
t.Fatal(err)
}
if strings.Contains(raw, "super-secret-token") || strings.Contains(raw, "pw123") {
t.Fatalf("secret leaked in persisted config: %s", raw)
}
cfg, err := s.decodeConfig(raw)
if err != nil {
t.Fatal(err)
}
if cfg["token"] != "super-secret-token" || cfg["password"] != "pw123" {
t.Fatalf("roundtrip mismatch: %#v", cfg)
}
}