Brad Ison | 43086e9 | 2016-03-29 18:37:57 -0400 | [diff] [blame] | 1 | package webhooks |
| 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 | |
| 16 | func TestListURL(t *testing.T) { |
| 17 | actual := listURL(endpointClient(), "123", "456") |
| 18 | expected := endpoint + "groups/123/policies/456/webhooks" |
| 19 | th.CheckEquals(t, expected, actual) |
| 20 | } |
| 21 | |
| 22 | func TestCreateURL(t *testing.T) { |
| 23 | actual := createURL(endpointClient(), "123", "456") |
| 24 | expected := endpoint + "groups/123/policies/456/webhooks" |
| 25 | th.CheckEquals(t, expected, actual) |
| 26 | } |
| 27 | |
| 28 | func TestGetURL(t *testing.T) { |
| 29 | actual := getURL(endpointClient(), "123", "456", "789") |
| 30 | expected := endpoint + "groups/123/policies/456/webhooks/789" |
| 31 | th.CheckEquals(t, expected, actual) |
| 32 | } |
| 33 | |
| 34 | func TestUpdateURL(t *testing.T) { |
| 35 | actual := updateURL(endpointClient(), "123", "456", "789") |
| 36 | expected := endpoint + "groups/123/policies/456/webhooks/789" |
| 37 | th.CheckEquals(t, expected, actual) |
| 38 | } |
| 39 | |
| 40 | func TestDeleteURL(t *testing.T) { |
| 41 | actual := deleteURL(endpointClient(), "123", "456", "789") |
| 42 | expected := endpoint + "groups/123/policies/456/webhooks/789" |
| 43 | th.CheckEquals(t, expected, actual) |
| 44 | } |