(t *testing.T)
| 433 | } |
| 434 | |
| 435 | func TestFormatProxyURL(t *testing.T) { |
| 436 | tests := []struct { |
| 437 | name string |
| 438 | in string |
| 439 | want string |
| 440 | }{ |
| 441 | {name: "empty", in: "", want: "<none>"}, |
| 442 | {name: "invalid", in: "http://[::1", want: "<redacted>"}, |
| 443 | {name: "fullURLRedactsUserinfoAndPath", in: "http://user:pass@example.com:8080/path?x=1#frag", want: "http://example.com:8080"}, |
| 444 | {name: "socks5RedactsUserinfoAndPath", in: "socks5://user:pass@192.168.1.1:1080/path?x=1", want: "socks5://192.168.1.1:1080"}, |
| 445 | {name: "socks5HostPort", in: "socks5://proxy.example.com:1080/", want: "socks5://proxy.example.com:1080"}, |
| 446 | {name: "hostPortNoScheme", in: "example.com:1234/path?x=1", want: "example.com:1234"}, |
| 447 | {name: "relativePathRedacted", in: "/just/path", want: "<redacted>"}, |
| 448 | {name: "schemeAndHost", in: "https://example.com", want: "https://example.com"}, |
| 449 | } |
| 450 | for _, tt := range tests { |
| 451 | t.Run(tt.name, func(t *testing.T) { |
| 452 | if got := formatProxyURL(tt.in); got != tt.want { |
| 453 | t.Fatalf("expected %q, got %q", tt.want, got) |
| 454 | } |
| 455 | }) |
| 456 | } |
| 457 | } |
| 458 | |
| 459 | func TestBuildConfigChangeDetails_RemoteManagementSecretUpdated(t *testing.T) { |
| 460 | oldCfg := &config.Config{ |
nothing calls this directly
no test coverage detected