blob: 2cbe3a7a56d82e8916e5c47cdfdc62f655877032 [file] [log] [blame]
Jamie Hannaford4721abc2014-09-16 16:29:04 +02001// +build acceptance networking
2
3package v2
4
5import (
6 "testing"
7
8 "github.com/rackspace/gophercloud"
9 "github.com/rackspace/gophercloud/openstack/networking/v2/extensions"
10 th "github.com/rackspace/gophercloud/testhelper"
11)
12
13func TestListExts(t *testing.T) {
14 Setup(t)
15 defer Teardown()
16
17 pager := extensions.List(Client)
18 err := pager.EachPage(func(page gophercloud.Page) (bool, error) {
19 t.Logf("--- Page ---")
20
21 exts, err := extensions.ExtractExtensions(page)
22 th.AssertNoErr(t, err)
23
24 for _, ext := range exts {
25 t.Logf("Extension: Name [%s] Description [%s]", ext.Name, ext.Description)
26 }
27
28 return true, nil
29 })
30 th.CheckNoErr(t, err)
31}
32
33func TestGetExt(t *testing.T) {
34 Setup(t)
35 defer Teardown()
36
37 ext, err := extensions.Get(Client, "service-type")
38 th.AssertNoErr(t, err)
39
40 th.AssertEquals(t, ext.Updated, "2013-01-20T00:00:00-00:00")
41 th.AssertEquals(t, ext.Name, "Neutron Service Type Management")
42 th.AssertEquals(t, ext.Namespace, "http://docs.openstack.org/ext/neutron/service-type/api/v1.0")
43 th.AssertEquals(t, ext.Alias, "service-type")
44 th.AssertEquals(t, ext.Description, "API for retrieving service providers for Neutron advanced services")
45}