jrperritt | 3d96616 | 2016-06-06 14:08:54 -0500 | [diff] [blame] | 1 | package testing |
Jon Perritt | 9a9c386 | 2015-01-19 17:16:22 -0700 | [diff] [blame] | 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | |
jrperritt | 3d96616 | 2016-06-06 14:08:54 -0500 | [diff] [blame] | 6 | "github.com/gophercloud/gophercloud/openstack/cdn/v1/base" |
Jon Perritt | 27249f4 | 2016-02-18 10:35:59 -0600 | [diff] [blame] | 7 | th "github.com/gophercloud/gophercloud/testhelper" |
| 8 | fake "github.com/gophercloud/gophercloud/testhelper/client" |
Jon Perritt | 9a9c386 | 2015-01-19 17:16:22 -0700 | [diff] [blame] | 9 | ) |
| 10 | |
Jon Perritt | 01e211b | 2015-01-20 19:21:34 -0700 | [diff] [blame] | 11 | func TestGetHomeDocument(t *testing.T) { |
Jon Perritt | 9a9c386 | 2015-01-19 17:16:22 -0700 | [diff] [blame] | 12 | th.SetupHTTP() |
| 13 | defer th.TeardownHTTP() |
| 14 | HandleGetSuccessfully(t) |
| 15 | |
jrperritt | 3d96616 | 2016-06-06 14:08:54 -0500 | [diff] [blame] | 16 | actual, err := base.Get(fake.ServiceClient()).Extract() |
Jon Perritt | 9a9c386 | 2015-01-19 17:16:22 -0700 | [diff] [blame] | 17 | th.CheckNoErr(t, err) |
| 18 | |
jrperritt | 3d96616 | 2016-06-06 14:08:54 -0500 | [diff] [blame] | 19 | expected := base.HomeDocument{ |
Jon Perritt | 6bb5944 | 2015-01-27 11:18:22 -0700 | [diff] [blame] | 20 | "rel/cdn": map[string]interface{}{ |
Jon Perritt | d341609 | 2015-03-27 10:36:34 -0600 | [diff] [blame] | 21 | "href-template": "services{?marker,limit}", |
| 22 | "href-vars": map[string]interface{}{ |
| 23 | "marker": "param/marker", |
| 24 | "limit": "param/limit", |
| 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 | 9a9c386 | 2015-01-19 17:16:22 -0700 | [diff] [blame] | 33 | } |
| 34 | th.CheckDeepEquals(t, expected, *actual) |
| 35 | } |
| 36 | |
Jon Perritt | 01e211b | 2015-01-20 19:21:34 -0700 | [diff] [blame] | 37 | func TestPing(t *testing.T) { |
Jon Perritt | 9a9c386 | 2015-01-19 17:16:22 -0700 | [diff] [blame] | 38 | th.SetupHTTP() |
| 39 | defer th.TeardownHTTP() |
| 40 | HandlePingSuccessfully(t) |
| 41 | |
jrperritt | 3d96616 | 2016-06-06 14:08:54 -0500 | [diff] [blame] | 42 | err := base.Ping(fake.ServiceClient()).ExtractErr() |
Jon Perritt | 9a9c386 | 2015-01-19 17:16:22 -0700 | [diff] [blame] | 43 | th.CheckNoErr(t, err) |
| 44 | } |