Jon Perritt | fd53bba | 2014-10-03 00:41:22 -0500 | [diff] [blame] | 1 | package apiversions |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | |
| 6 | "github.com/rackspace/gophercloud" |
| 7 | th "github.com/rackspace/gophercloud/testhelper" |
| 8 | ) |
| 9 | |
| 10 | const endpoint = "http://localhost:57909/" |
Marcin Krolik | 14c8801 | 2016-02-16 08:59:48 +0100 | [diff] [blame^] | 11 | const endpoint2 = "http://localhost:57909/v1/3a02ee0b5cf14816b41b17e851d29a94" |
Jon Perritt | fd53bba | 2014-10-03 00:41:22 -0500 | [diff] [blame] | 12 | |
| 13 | func endpointClient() *gophercloud.ServiceClient { |
| 14 | return &gophercloud.ServiceClient{Endpoint: endpoint} |
| 15 | } |
| 16 | |
Marcin Krolik | 14c8801 | 2016-02-16 08:59:48 +0100 | [diff] [blame^] | 17 | func endpointClient2() *gophercloud.ServiceClient { |
| 18 | return &gophercloud.ServiceClient{Endpoint: endpoint2} |
| 19 | } |
| 20 | |
Jon Perritt | fd53bba | 2014-10-03 00:41:22 -0500 | [diff] [blame] | 21 | func TestGetURL(t *testing.T) { |
| 22 | actual := getURL(endpointClient(), "v1") |
| 23 | expected := endpoint + "v1/" |
| 24 | th.AssertEquals(t, expected, actual) |
| 25 | } |
| 26 | |
| 27 | func TestListURL(t *testing.T) { |
Marcin Krolik | 14c8801 | 2016-02-16 08:59:48 +0100 | [diff] [blame^] | 28 | actual := listURL(endpointClient2()) |
Jon Perritt | fd53bba | 2014-10-03 00:41:22 -0500 | [diff] [blame] | 29 | expected := endpoint |
| 30 | th.AssertEquals(t, expected, actual) |
| 31 | } |