Ash Wilson | e9a0089 | 2014-10-03 16:40:22 -0400 | [diff] [blame] | 1 | // +build acceptance |
| 2 | |
| 3 | package v2 |
| 4 | |
| 5 | import ( |
| 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 | |
| 13 | func 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 Wilson | 5872fea | 2014-10-03 16:53:01 -0400 | [diff] [blame] | 35 | |
| 36 | func 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 | } |