blob: a8d95f9ace92be0da64fcef9125754b915640019 [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{
Jon Perritt6bb59442015-01-27 11:18:22 -070019 "rel/cdn": map[string]interface{}{
Jon Perritt9a9c3862015-01-19 17:16:22 -070020 "href-template": "services{?marker,limit}",
Jon Perritt6bb59442015-01-27 11:18:22 -070021 "href-vars": map[string]interface{}{
Jon Perritt9a9c3862015-01-19 17:16:22 -070022 "marker": "param/marker",
Jon Perritt6bb59442015-01-27 11:18:22 -070023 "limit": "param/limit",
Jon Perritt9a9c3862015-01-19 17:16:22 -070024 },
Jon Perritt6bb59442015-01-27 11:18:22 -070025 "hints": map[string]interface{}{
26 "allow": []string{"GET"},
27 "formats": map[string]interface{}{
28 "application/json": map[string]interface{}{},
29 },
30 },
31 },
Jon Perritt9a9c3862015-01-19 17:16:22 -070032 }
33 th.CheckDeepEquals(t, expected, *actual)
34}
35
Jon Perritt01e211b2015-01-20 19:21:34 -070036func TestPing(t *testing.T) {
Jon Perritt9a9c3862015-01-19 17:16:22 -070037 th.SetupHTTP()
38 defer th.TeardownHTTP()
39 HandlePingSuccessfully(t)
40
41 err := Ping(fake.ServiceClient()).ExtractErr()
42 th.CheckNoErr(t, err)
43}