| 1 | package config |
| 2 | |
| 3 | import "testing" |
| 4 | |
| 5 | func TestModelConnectionTargetRedactsCredentialsAndPaths(t *testing.T) { |
| 6 | for input, want := range map[string]string{ |
| 7 | "https://user:secret@example.com:443/tenant-secret?key=secret#secret": "https://example.com:443", |
| 8 | "http://127.0.0.1:8080/token": "http://127.0.0.1:8080", |
| 9 | "file:///secret": "", "not a URL": "", |
| 10 | } { |
| 11 | if got := SafeModelConnectionTarget(input); got != want { |
| 12 | t.Fatalf("safe endpoint = %q, want %q", got, want) |
| 13 | } |
| 14 | } |
| 15 | } |
| 16 |