blob: 298065639c2bb33cc57e302ec41deb1a233c75b7 [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{
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
39func 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}