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