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{ |
| 20 | "rel/cdn": `{ |
| 21 | "href-template": "services{?marker,limit}", |
| 22 | "href-vars": { |
| 23 | "marker": "param/marker", |
| 24 | "limit": "param/limit" |
| 25 | }, |
| 26 | "hints": { |
| 27 | "allow": [ |
| 28 | "GET" |
| 29 | ], |
| 30 | "formats": { |
| 31 | "application/json": {} |
| 32 | } |
| 33 | } |
| 34 | }`, |
| 35 | } |
| 36 | th.CheckDeepEquals(t, expected, *actual) |
| 37 | } |
| 38 | |
| 39 | func TestPing(t *testing.T) { |
| 40 | th.SetupHTTP() |
| 41 | defer th.TeardownHTTP() |
| 42 | os.HandlePingSuccessfully(t) |
| 43 | |
| 44 | err := Ping(fake.ServiceClient()).ExtractErr() |
| 45 | th.CheckNoErr(t, err) |
| 46 | } |