This repository was archived by the owner on Aug 1, 2023. It is now read-only.
File tree Expand file tree Collapse file tree
openstack/blockstorage/v1/apiversions Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package apiversions
22
33import (
44 "strings"
5+ "net/url"
56
67 "github.com/rackspace/gophercloud"
78)
@@ -11,5 +12,7 @@ func getURL(c *gophercloud.ServiceClient, version string) string {
1112}
1213
1314func listURL (c * gophercloud.ServiceClient ) string {
14- return c .ServiceURL ("" )
15+ u , _ := url .Parse (c .ServiceURL ("" ))
16+ u .Path = "/"
17+ return u .String ()
1518}
Original file line number Diff line number Diff line change @@ -8,19 +8,24 @@ import (
88)
99
1010const endpoint = "http://localhost:57909/"
11+ const endpoint2 = "http://localhost:57909/v1/3a02ee0b5cf14816b41b17e851d29a94"
1112
1213func endpointClient () * gophercloud.ServiceClient {
1314 return & gophercloud.ServiceClient {Endpoint : endpoint }
1415}
1516
17+ func endpointClient2 () * gophercloud.ServiceClient {
18+ return & gophercloud.ServiceClient {Endpoint : endpoint2 }
19+ }
20+
1621func TestGetURL (t * testing.T ) {
1722 actual := getURL (endpointClient (), "v1" )
1823 expected := endpoint + "v1/"
1924 th .AssertEquals (t , expected , actual )
2025}
2126
2227func TestListURL (t * testing.T ) {
23- actual := listURL (endpointClient ())
28+ actual := listURL (endpointClient2 ())
2429 expected := endpoint
2530 th .AssertEquals (t , expected , actual )
2631}
You can’t perform that action at this time.
0 commit comments