|
| 1 | +package policies |
| 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") |
| 18 | + expected := endpoint + "groups/123/policies" |
| 19 | + th.CheckEquals(t, expected, actual) |
| 20 | +} |
| 21 | + |
| 22 | +func TestCreateURL(t *testing.T) { |
| 23 | + actual := createURL(endpointClient(), "123") |
| 24 | + expected := endpoint + "groups/123/policies" |
| 25 | + th.CheckEquals(t, expected, actual) |
| 26 | +} |
| 27 | + |
| 28 | +func TestGetURL(t *testing.T) { |
| 29 | + actual := getURL(endpointClient(), "123", "456") |
| 30 | + expected := endpoint + "groups/123/policies/456" |
| 31 | + th.CheckEquals(t, expected, actual) |
| 32 | +} |
| 33 | + |
| 34 | +func TestUpdateURL(t *testing.T) { |
| 35 | + actual := updateURL(endpointClient(), "123", "456") |
| 36 | + expected := endpoint + "groups/123/policies/456" |
| 37 | + th.CheckEquals(t, expected, actual) |
| 38 | +} |
| 39 | + |
| 40 | +func TestDeleteURL(t *testing.T) { |
| 41 | + actual := deleteURL(endpointClient(), "123", "456") |
| 42 | + expected := endpoint + "groups/123/policies/456" |
| 43 | + th.CheckEquals(t, expected, actual) |
| 44 | +} |
| 45 | + |
| 46 | +func TestExecuteURL(t *testing.T) { |
| 47 | + actual := executeURL(endpointClient(), "123", "456") |
| 48 | + expected := endpoint + "groups/123/policies/456/execute" |
| 49 | + th.CheckEquals(t, expected, actual) |
| 50 | +} |
0 commit comments