blob: edcbba4fd15fc223cce7ef05622752036687e5c4 [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/extensions"
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 TestListExts(t *testing.T) {
14 Setup(t)
15 defer Teardown()
16
17 pager := extensions.List(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 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
Jamie Hannafordd9036422014-09-23 17:50:24 +020037 ext, err := extensions.Get(Client, "service-type").Extract()
Jamie Hannaford4721abc2014-09-16 16:29:04 +020038 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}