github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/settings_test.go (about) 1 package api 2 3 import ( 4 "os" 5 "testing" 6 7 "github.com/ActiveState/cli/internal/constants" 8 "github.com/stretchr/testify/assert" 9 ) 10 11 func TestGetServiceURL(t *testing.T) { 12 u := GetServiceURL(ServiceMono) 13 assert.Equal(t, "https://platform.testing.tld"+constants.MonoAPIPath, u.String(), "Returns the expected service url") 14 } 15 16 func TestGetProjectHost(t *testing.T) { 17 os.Setenv(constants.APIHostEnvVarName, constants.DefaultAPIHost) 18 defer func() { 19 os.Unsetenv(constants.APIHostEnvVarName) 20 }() 21 22 host := getProjectHost(ServiceMono) 23 assert.Equal(t, constants.DefaultAPIHost, *host) 24 }