blob: 4077022bb1296c0ebc69404a6cfbf3310d6e7d54 [file] [log] [blame]
Jon Perritt9a9c3862015-01-19 17:16:22 -07001package base
2
3import (
4 "testing"
5
6 th "github.com/rackspace/gophercloud/testhelper"
7 fake "github.com/rackspace/gophercloud/testhelper/client"
8)
9
Jon Perritt01e211b2015-01-20 19:21:34 -070010func TestGetHomeDocument(t *testing.T) {
Jon Perritt9a9c3862015-01-19 17:16:22 -070011 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{
19 "rel/cdn": `{
20 "href-template": "services{?marker,limit}",
21 "href-vars": {
22 "marker": "param/marker",
23 "limit": "param/limit"
24 },
25 "hints": {
26 "allow": [
27 "GET"
28 ],
29 "formats": {
30 "application/json": {}
31 }
32 }
33 }`,
34 }
35 th.CheckDeepEquals(t, expected, *actual)
36}
37
Jon Perritt01e211b2015-01-20 19:21:34 -070038func TestPing(t *testing.T) {
Jon Perritt9a9c3862015-01-19 17:16:22 -070039 th.SetupHTTP()
40 defer th.TeardownHTTP()
41 HandlePingSuccessfully(t)
42
43 err := Ping(fake.ServiceClient()).ExtractErr()
44 th.CheckNoErr(t, err)
45}