Jon Perritt | 59c4abe | 2015-01-23 10:42:14 -0700 | [diff] [blame] | 1 | package base |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | |
| 6 | os "github.com/rackspace/gophercloud/openstack/cdn/v1/base" |
| 7 | th "github.com/rackspace/gophercloud/testhelper" |
| 8 | fake "github.com/rackspace/gophercloud/testhelper/client" |
| 9 | ) |
| 10 | |
| 11 | func TestGetHomeDocument(t *testing.T) { |
| 12 | th.SetupHTTP() |
| 13 | defer th.TeardownHTTP() |
| 14 | os.HandleGetSuccessfully(t) |
| 15 | |
| 16 | actual, err := Get(fake.ServiceClient()).Extract() |
| 17 | th.CheckNoErr(t, err) |
| 18 | |
| 19 | expected := os.HomeDocument{ |
Jon Perritt | 8347df7 | 2015-01-27 11:33:40 -0700 | [diff] [blame] | 20 | "rel/cdn": map[string]interface{}{ |
| 21 | "href-template": "services{?marker,limit}", |
| 22 | "href-vars": map[string]interface{}{ |
| 23 | "marker": "param/marker", |
Jon Perritt | d341609 | 2015-03-27 10:36:34 -0600 | [diff] [blame^] | 24 | "limit": "param/limit", |
Jon Perritt | 8347df7 | 2015-01-27 11:33:40 -0700 | [diff] [blame] | 25 | }, |
| 26 | "hints": map[string]interface{}{ |
| 27 | "allow": []string{"GET"}, |
| 28 | "formats": map[string]interface{}{ |
| 29 | "application/json": map[string]interface{}{}, |
| 30 | }, |
| 31 | }, |
| 32 | }, |
Jon Perritt | 59c4abe | 2015-01-23 10:42:14 -0700 | [diff] [blame] | 33 | } |
| 34 | th.CheckDeepEquals(t, expected, *actual) |
| 35 | } |
| 36 | |
| 37 | func TestPing(t *testing.T) { |
| 38 | th.SetupHTTP() |
| 39 | defer th.TeardownHTTP() |
| 40 | os.HandlePingSuccessfully(t) |
| 41 | |
| 42 | err := Ping(fake.ServiceClient()).ExtractErr() |
| 43 | th.CheckNoErr(t, err) |
| 44 | } |