github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/testing/endpoint_util_test.go (about) 1 package testing 2 3 import ( 4 "testing" 5 6 "github.com/opentelekomcloud/gophertelekomcloud/openstack" 7 th "github.com/opentelekomcloud/gophertelekomcloud/testhelper" 8 ) 9 10 func TestContainsProjectId(t *testing.T) { 11 endpointContains := []string{"https://as.eu-de.otc.t-systems.com/autoscaling-api/v1/f9842224f84e44f99c2878eddc7f9ef5", 12 "https://elb.t-systems.com/rds/v1.0/c9842224f84e44f99c2878eddc7f9ef5/", 13 "https://elb.eu-de.otc.t-systems.com/v1.1/c9842224f84e44f99c2878eddc7f9ef5", 14 "https://elb.eu-de.otc.t-systems.com/v2/c9842224f84e44f99c2878eddc7f9ef5", 15 "https://elb.eu-de.otc.t-systems.com/v2.0/c9842224f84e44f99c2878eddc7f9ef5", 16 "https://elb.eu-de.otc.t-systems.com/V2.0/c9842224f84e44f99c2878eddc7f9ef5/list", 17 "https://as.eu-de.otc.t-systems.com/autoscaling-api/v1/c9842224f84e44f99c2878eddc7f9ef5/abc", 18 "https://as.eu-de.otc.t-systems.com/autoscaling-api/V11/c9842224f84e44f99c2878eddc7f9ef5", 19 "https://as.eu-de.otc.t-systems.com/autoscaling-api/v2/c9842224f84e44f99c2878eddc7f9ef5", 20 "https://as.eu-de.otc.t-systems.com/autoscaling-api/V2/c9842224f84e44f99c2878eddc7f9ef5", 21 "http://as.eu-de.otc.t-systems.com/autoscaling-api/V2/c9842224f84e44f99c2878eddc7f9ef5"} 22 23 for _, enpoint := range endpointContains { 24 th.AssertEquals(t, true, openstack.ContainsProjectId(enpoint)) 25 } 26 } 27 28 func TestNotContainsProjectId(t *testing.T) { 29 endpointContains := []string{"https://as.eu-de.otc.t-systems.com/autoscaling-api/v1", 30 "https://as.eu-de.otc.t-systems.com/autoscaling-api/v1/", 31 "https://as.eu-de.otc.t-systems.com/autoscaling-api/v1/abc", 32 "https://as.eu-de.otc.t-systems.com/autoscaling-api/V1"} 33 34 for _, enpoint := range endpointContains { 35 th.AssertEquals(t, false, openstack.ContainsProjectId(enpoint)) 36 } 37 }