blob: 731fc6dd00c128a3bed29f35292ed6702487c6fa [file] [log] [blame]
Jon Perritt59c4abe2015-01-23 10:42:14 -07001package base
2
3import (
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
11func 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 Perritt8347df72015-01-27 11:33:40 -070020 "rel/cdn": map[string]interface{}{
21 "href-template": "services{?marker,limit}",
22 "href-vars": map[string]interface{}{
23 "marker": "param/marker",
Jon Perrittd3416092015-03-27 10:36:34 -060024 "limit": "param/limit",
Jon Perritt8347df72015-01-27 11:33:40 -070025 },
26 "hints": map[string]interface{}{
27 "allow": []string{"GET"},
28 "formats": map[string]interface{}{
29 "application/json": map[string]interface{}{},
30 },
31 },
32 },
Jon Perritt59c4abe2015-01-23 10:42:14 -070033 }
34 th.CheckDeepEquals(t, expected, *actual)
35}
36
37func 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}