Files
pipelines/internal/statusview/status_test.go
T

22 lines
643 B
Go

package statusview
import (
"strings"
"testing"
)
func TestOfflineStatusIncludesBothServicesAndRedactsURLCredentials(t *testing.T) {
s := Offline("ws://user:password@localhost:8080/connect?token=secret#secret")
text := strings.Join(Lines(s), "\n")
for _, secret := range []string{"password", "token=", "secret", "user:"} {
if strings.Contains(text, secret) {
t.Fatal("credentials exposed", text)
}
}
for _, expected := range []string{"Pipelines server", "unreachable", "ntfy", "unknown (server unavailable)", "8080"} {
if !strings.Contains(text, expected) {
t.Fatal("missing offline information", expected, text)
}
}
}