Jon Perritt | e747a0f | 2014-09-29 19:54:55 -0500 | [diff] [blame] | 1 | package snapshots |
Jon Perritt | 82522ca | 2014-09-29 22:31:31 -0500 | [diff] [blame] | 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" |
| 11 | |
| 12 | func endpointClient() *gophercloud.ServiceClient { |
| 13 | return &gophercloud.ServiceClient{Endpoint: endpoint} |
| 14 | } |
| 15 | |
Jon Perritt | 6d5561b | 2014-10-01 21:42:15 -0500 | [diff] [blame] | 16 | func TestCreateURL(t *testing.T) { |
| 17 | actual := createURL(endpointClient()) |
Jon Perritt | 82522ca | 2014-09-29 22:31:31 -0500 | [diff] [blame] | 18 | expected := endpoint + "snapshots" |
| 19 | th.AssertEquals(t, expected, actual) |
| 20 | } |
| 21 | |
Jon Perritt | 6d5561b | 2014-10-01 21:42:15 -0500 | [diff] [blame] | 22 | func TestDeleteURL(t *testing.T) { |
| 23 | actual := deleteURL(endpointClient(), "foo") |
Jon Perritt | 82522ca | 2014-09-29 22:31:31 -0500 | [diff] [blame] | 24 | expected := endpoint + "snapshots/foo" |
| 25 | th.AssertEquals(t, expected, actual) |
| 26 | } |
Jon Perritt | 6d5561b | 2014-10-01 21:42:15 -0500 | [diff] [blame] | 27 | |
| 28 | func TestGetURL(t *testing.T) { |
| 29 | actual := getURL(endpointClient(), "foo") |
| 30 | expected := endpoint + "snapshots/foo" |
| 31 | th.AssertEquals(t, expected, actual) |
| 32 | } |
| 33 | |
| 34 | func TestListURL(t *testing.T) { |
| 35 | actual := listURL(endpointClient()) |
| 36 | expected := endpoint + "snapshots" |
| 37 | th.AssertEquals(t, expected, actual) |
| 38 | } |
| 39 | |
| 40 | func TestMetadataURL(t *testing.T) { |
| 41 | actual := metadataURL(endpointClient(), "foo") |
| 42 | expected := endpoint + "snapshots/foo/metadata" |
| 43 | th.AssertEquals(t, expected, actual) |
| 44 | } |
| 45 | |
Jon Perritt | e357e3d | 2014-10-03 01:53:57 -0500 | [diff] [blame] | 46 | func TestUpdateMetadataURL(t *testing.T) { |
| 47 | actual := updateMetadataURL(endpointClient(), "foo") |
Jon Perritt | 6d5561b | 2014-10-01 21:42:15 -0500 | [diff] [blame] | 48 | expected := endpoint + "snapshots/foo/metadata" |
| 49 | th.AssertEquals(t, expected, actual) |
| 50 | } |