(t *testing.T)
| 188 | } |
| 189 | |
| 190 | func TestGCPProviderCustomAudience(t *testing.T) { |
| 191 | mockClient := &http.Client{ |
| 192 | Transport: roundTripFunc(func(req *http.Request) (*http.Response, error) { |
| 193 | if !strings.Contains(req.URL.RawQuery, "audience=https%3A%2F%2Fcustom.openai.com") { |
| 194 | t.Fatalf("Expected custom audience in URL, got %q", req.URL.RawQuery) |
| 195 | } |
| 196 | return &http.Response{ |
| 197 | StatusCode: http.StatusOK, |
| 198 | Body: io.NopCloser(strings.NewReader("gcp-custom-token-jwt")), |
| 199 | Header: make(http.Header), |
| 200 | }, nil |
| 201 | }), |
| 202 | } |
| 203 | |
| 204 | provider := auth.GCPIDTokenProvider(&auth.GCPIDTokenProviderConfig{ |
| 205 | Audience: "https://custom.openai.com", |
| 206 | }) |
| 207 | token, err := provider.GetToken(context.Background(), mockClient) |
| 208 | if err != nil { |
| 209 | t.Fatalf("GetToken() error = %v", err) |
| 210 | } |
| 211 | if token != "gcp-custom-token-jwt" { |
| 212 | t.Errorf("GetToken() = %q, want %q", token, "gcp-custom-token-jwt") |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | func TestAzureProviderNilConfigBackwardCompatibility(t *testing.T) { |
| 217 | mockClient := &http.Client{ |
nothing calls this directly
no test coverage detected
searching dependent graphs…