github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/testing/endpoint_search_test.go (about)

     1  package testing
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/huaweicloud/golangsdk"
     7  	th "github.com/huaweicloud/golangsdk/testhelper"
     8  )
     9  
    10  func TestApplyDefaultsToEndpointOpts(t *testing.T) {
    11  	eo := golangsdk.EndpointOpts{Availability: golangsdk.AvailabilityPublic}
    12  	eo.ApplyDefaults("compute")
    13  	expected := golangsdk.EndpointOpts{Availability: golangsdk.AvailabilityPublic, Type: "compute"}
    14  	th.CheckDeepEquals(t, expected, eo)
    15  
    16  	eo = golangsdk.EndpointOpts{Type: "compute"}
    17  	eo.ApplyDefaults("object-store")
    18  	expected = golangsdk.EndpointOpts{Availability: golangsdk.AvailabilityPublic, Type: "compute"}
    19  	th.CheckDeepEquals(t, expected, eo)
    20  }