File: base_test.go

package info (click to toggle)
golang-github-rackspace-gophercloud 1.0.0%2Bgit20160603.920.934dbf8-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 4,936 kB
  • ctags: 6,116
  • sloc: sh: 16; makefile: 4
file content (32 lines) | stat: -rw-r--r-- 735 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// +build acceptance

package v1

import (
	"testing"

	"github.com/rackspace/gophercloud"
	"github.com/rackspace/gophercloud/rackspace/cdn/v1/base"
	th "github.com/rackspace/gophercloud/testhelper"
)

func TestBaseOps(t *testing.T) {
	client := newClient(t)
	t.Log("Retrieving Home Document")
	testHomeDocumentGet(t, client)

	t.Log("Pinging root URL")
	testPing(t, client)
}

func testHomeDocumentGet(t *testing.T, client *gophercloud.ServiceClient) {
	hd, err := base.Get(client).Extract()
	th.AssertNoErr(t, err)
	t.Logf("Retrieved home document: %+v", *hd)
}

func testPing(t *testing.T, client *gophercloud.ServiceClient) {
	err := base.Ping(client).ExtractErr()
	th.AssertNoErr(t, err)
	t.Logf("Successfully pinged root URL")
}