blob: 99e1d011875e2e61fc6c117defa7a3c109ca0417 [file] [log] [blame]
Jamie Hannaford4721abc2014-09-16 16:29:04 +02001// +build acceptance networking
2
3package v2
4
5import (
6 "testing"
7
Jamie Hannaford4721abc2014-09-16 16:29:04 +02008 "github.com/rackspace/gophercloud/openstack/networking/v2/apiversions"
Jamie Hannafordf0c615b2014-09-17 10:56:52 +02009 "github.com/rackspace/gophercloud/pagination"
Jamie Hannaford4721abc2014-09-16 16:29:04 +020010 th "github.com/rackspace/gophercloud/testhelper"
11)
12
13func TestListAPIVersions(t *testing.T) {
14 Setup(t)
15 defer Teardown()
16
17 pager := apiversions.ListVersions(Client)
Jamie Hannafordf0c615b2014-09-17 10:56:52 +020018 err := pager.EachPage(func(page pagination.Page) (bool, error) {
Jamie Hannaford4721abc2014-09-16 16:29:04 +020019 t.Logf("--- Page ---")
20
21 versions, err := apiversions.ExtractAPIVersions(page)
22 th.AssertNoErr(t, err)
23
24 for _, v := range versions {
25 t.Logf("API Version: ID [%s] Status [%s]", v.ID, v.Status)
26 }
27
28 return true, nil
29 })
30 th.CheckNoErr(t, err)
31}
32
33func TestListAPIResources(t *testing.T) {
34 Setup(t)
35 defer Teardown()
36
37 pager := apiversions.ListVersionResources(Client, "v2.0")
Jamie Hannafordf0c615b2014-09-17 10:56:52 +020038 err := pager.EachPage(func(page pagination.Page) (bool, error) {
Jamie Hannaford4721abc2014-09-16 16:29:04 +020039 t.Logf("--- Page ---")
40
41 vrs, err := apiversions.ExtractVersionResources(page)
42 th.AssertNoErr(t, err)
43
44 for _, vr := range vrs {
45 t.Logf("Network: Name [%s] Collection [%s]", vr.Name, vr.Collection)
46 }
47
48 return true, nil
49 })
50 th.CheckNoErr(t, err)
51}