blob: 2b4e062aef15ebb9e68c2fa3075cab1bc6b5d7a0 [file] [log] [blame]
Ash Wilsone9a00892014-10-03 16:40:22 -04001// +build acceptance
2
3package v2
4
5import (
6 "testing"
7
8 extensions2 "github.com/rackspace/gophercloud/openstack/identity/v2/extensions"
9 "github.com/rackspace/gophercloud/pagination"
10 th "github.com/rackspace/gophercloud/testhelper"
11)
12
13func TestEnumerateExtensions(t *testing.T) {
14 service := authenticatedClient(t)
15
16 t.Logf("Extensions available on this identity endpoint:")
17 count := 0
18 err := extensions2.List(service).EachPage(func(page pagination.Page) (bool, error) {
19 t.Logf("--- Page %02d ---", count)
20
21 extensions, err := extensions2.ExtractExtensions(page)
22 th.AssertNoErr(t, err)
23
24 for i, ext := range extensions {
25 t.Logf("[%02d] name=[%s] namespace=[%s]", i, ext.Name, ext.Namespace)
26 t.Logf(" alias=[%s] updated=[%s]", ext.Alias, ext.Updated)
27 t.Logf(" description=[%s]", ext.Description)
28 }
29
30 count++
31 return true, nil
32 })
33 th.AssertNoErr(t, err)
34}
Ash Wilson5872fea2014-10-03 16:53:01 -040035
36func TestGetExtension(t *testing.T) {
37 service := authenticatedClient(t)
38
39 ext, err := extensions2.Get(service, "OS-KSCRUD").Extract()
40 th.AssertNoErr(t, err)
41
42 th.CheckEquals(t, "OpenStack Keystone User CRUD", ext.Name)
43 th.CheckEquals(t, "http://docs.openstack.org/identity/api/ext/OS-KSCRUD/v1.0", ext.Namespace)
44 th.CheckEquals(t, "OS-KSCRUD", ext.Alias)
45 th.CheckEquals(t, "OpenStack extensions to Keystone v2.0 API enabling User Operations.", ext.Description)
46}