Files
new-api-custom/relay/channel/vertex/url_builder_test.go
T

26 lines
1.0 KiB
Go

package vertex
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestBuildGoogleModelURLUsesTheLocationHost(t *testing.T) {
tests := []struct {
region string
want string
}{
{"global", "https://aiplatform.googleapis.com/v1/projects/my-project/locations/global/publishers/google/models/gemini-4-argon:generateContent"},
{"us-central1", "https://us-central1-aiplatform.googleapis.com/v1/projects/my-project/locations/us-central1/publishers/google/models/gemini-4-argon:generateContent"},
{"us", "https://aiplatform.us.rep.googleapis.com/v1/projects/my-project/locations/us/publishers/google/models/gemini-4-argon:generateContent"},
{"eu", "https://aiplatform.eu.rep.googleapis.com/v1/projects/my-project/locations/eu/publishers/google/models/gemini-4-argon:generateContent"},
}
for _, tt := range tests {
t.Run(tt.region, func(t *testing.T) {
got := BuildGoogleModelURL("", DefaultAPIVersion, "my-project", tt.region, "gemini-4-argon", "generateContent")
assert.Equal(t, tt.want, got)
})
}
}