blob: cd1209bb9c605ff0037b638fd16c3bfcb8b3b5f8 [file] [log] [blame]
jrperritt3d966162016-06-06 14:08:54 -05001package testing
Jon Perritt9a9c3862015-01-19 17:16:22 -07002
3import (
4 "testing"
5
jrperritt3d966162016-06-06 14:08:54 -05006 "github.com/gophercloud/gophercloud/openstack/cdn/v1/base"
Jon Perritt27249f42016-02-18 10:35:59 -06007 th "github.com/gophercloud/gophercloud/testhelper"
8 fake "github.com/gophercloud/gophercloud/testhelper/client"
Jon Perritt9a9c3862015-01-19 17:16:22 -07009)
10
Jon Perritt01e211b2015-01-20 19:21:34 -070011func TestGetHomeDocument(t *testing.T) {
Jon Perritt9a9c3862015-01-19 17:16:22 -070012 th.SetupHTTP()
13 defer th.TeardownHTTP()
14 HandleGetSuccessfully(t)
15
jrperritt3d966162016-06-06 14:08:54 -050016 actual, err := base.Get(fake.ServiceClient()).Extract()
Jon Perritt9a9c3862015-01-19 17:16:22 -070017 th.CheckNoErr(t, err)
18
jrperritt3d966162016-06-06 14:08:54 -050019 expected := base.HomeDocument{
Jon Perritt6bb59442015-01-27 11:18:22 -070020 "rel/cdn": map[string]interface{}{
Jon Perrittd3416092015-03-27 10:36:34 -060021 "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 Perritt9a9c3862015-01-19 17:16:22 -070033 }
34 th.CheckDeepEquals(t, expected, *actual)
35}
36
Jon Perritt01e211b2015-01-20 19:21:34 -070037func TestPing(t *testing.T) {
Jon Perritt9a9c3862015-01-19 17:16:22 -070038 th.SetupHTTP()
39 defer th.TeardownHTTP()
40 HandlePingSuccessfully(t)
41
jrperritt3d966162016-06-06 14:08:54 -050042 err := base.Ping(fake.ServiceClient()).ExtractErr()
Jon Perritt9a9c3862015-01-19 17:16:22 -070043 th.CheckNoErr(t, err)
44}