Jamie Hannaford | 89f9af2 | 2014-09-17 12:21:48 +0200 | [diff] [blame] | 1 | package subnets |
Jamie Hannaford | 0708c00 | 2014-09-17 16:08:49 +0200 | [diff] [blame] | 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | |
| 6 | "github.com/rackspace/gophercloud" |
| 7 | th "github.com/rackspace/gophercloud/testhelper" |
| 8 | ) |
| 9 | |
Jamie Hannaford | 686c496 | 2014-09-23 10:46:20 +0200 | [diff] [blame^] | 10 | const endpoint = "http://localhost:57909/" |
Jamie Hannaford | 0708c00 | 2014-09-17 16:08:49 +0200 | [diff] [blame] | 11 | |
Jamie Hannaford | 686c496 | 2014-09-23 10:46:20 +0200 | [diff] [blame^] | 12 | func endpointClient() *gophercloud.ServiceClient { |
| 13 | return &gophercloud.ServiceClient{Endpoint: endpoint} |
Jamie Hannaford | 0708c00 | 2014-09-17 16:08:49 +0200 | [diff] [blame] | 14 | } |
| 15 | |
| 16 | func TestListURL(t *testing.T) { |
Jamie Hannaford | 686c496 | 2014-09-23 10:46:20 +0200 | [diff] [blame^] | 17 | actual := listURL(endpointClient()) |
| 18 | expected := endpoint + "v2.0/subnets" |
Jamie Hannaford | 0708c00 | 2014-09-17 16:08:49 +0200 | [diff] [blame] | 19 | th.AssertEquals(t, expected, actual) |
| 20 | } |
| 21 | |
| 22 | func TestGetURL(t *testing.T) { |
Jamie Hannaford | 686c496 | 2014-09-23 10:46:20 +0200 | [diff] [blame^] | 23 | actual := getURL(endpointClient(), "foo") |
| 24 | expected := endpoint + "v2.0/subnets/foo" |
Jamie Hannaford | 0708c00 | 2014-09-17 16:08:49 +0200 | [diff] [blame] | 25 | th.AssertEquals(t, expected, actual) |
| 26 | } |
Jamie Hannaford | 6363143 | 2014-09-18 11:40:09 +0200 | [diff] [blame] | 27 | |
| 28 | func TestCreateURL(t *testing.T) { |
Jamie Hannaford | 686c496 | 2014-09-23 10:46:20 +0200 | [diff] [blame^] | 29 | actual := createURL(endpointClient()) |
| 30 | expected := endpoint + "v2.0/subnets" |
Jamie Hannaford | 6363143 | 2014-09-18 11:40:09 +0200 | [diff] [blame] | 31 | th.AssertEquals(t, expected, actual) |
| 32 | } |
Jamie Hannaford | d11e20c | 2014-09-18 12:03:01 +0200 | [diff] [blame] | 33 | |
| 34 | func TestUpdateURL(t *testing.T) { |
Jamie Hannaford | 686c496 | 2014-09-23 10:46:20 +0200 | [diff] [blame^] | 35 | actual := updateURL(endpointClient(), "foo") |
| 36 | expected := endpoint + "v2.0/subnets/foo" |
Jamie Hannaford | d11e20c | 2014-09-18 12:03:01 +0200 | [diff] [blame] | 37 | th.AssertEquals(t, expected, actual) |
| 38 | } |
| 39 | |
| 40 | func TestDeleteURL(t *testing.T) { |
Jamie Hannaford | 686c496 | 2014-09-23 10:46:20 +0200 | [diff] [blame^] | 41 | actual := deleteURL(endpointClient(), "foo") |
| 42 | expected := endpoint + "v2.0/subnets/foo" |
Jamie Hannaford | d11e20c | 2014-09-18 12:03:01 +0200 | [diff] [blame] | 43 | th.AssertEquals(t, expected, actual) |
| 44 | } |