| 868 | } |
| 869 | |
| 870 | func TestRedactURL(t *testing.T) { |
| 871 | t.Parallel() |
| 872 | |
| 873 | tests := []struct { |
| 874 | name string |
| 875 | input string |
| 876 | expected string |
| 877 | }{ |
| 878 | {"plain", "https://mcp.example.com/v1", "https://mcp.example.com/v1"}, |
| 879 | {"with userinfo", "https://user:secret@mcp.example.com/v1", "https://mcp.example.com/v1"}, |
| 880 | {"with query params", "https://mcp.example.com/v1?api_key=sk-123", "https://mcp.example.com/v1"}, |
| 881 | {"with both", "https://user:pass@host/p?key=val", "https://host/p"}, |
| 882 | {"invalid url", "://not-a-url", "://not-a-url"}, |
| 883 | } |
| 884 | |
| 885 | for _, tt := range tests { |
| 886 | t.Run(tt.name, func(t *testing.T) { |
| 887 | t.Parallel() |
| 888 | got := mcpclient.RedactURL(tt.input) |
| 889 | assert.Equal(t, tt.expected, got) |
| 890 | }) |
| 891 | } |
| 892 | } |
| 893 | |
| 894 | func TestConnectAll_ExpiredToken(t *testing.T) { |
| 895 | t.Parallel() |