Ash Wilson | a5b1a14 | 2014-10-22 10:16:03 -0400 | [diff] [blame] | 1 | // +build acceptance compute extensionss |
| 2 | |
| 3 | package v2 |
| 4 | |
| 5 | import ( |
| 6 | "testing" |
| 7 | |
Jon Perritt | 27249f4 | 2016-02-18 10:35:59 -0600 | [diff] [blame^] | 8 | "github.com/gophercloud/gophercloud/openstack/compute/v2/extensions" |
| 9 | "github.com/gophercloud/gophercloud/pagination" |
| 10 | th "github.com/gophercloud/gophercloud/testhelper" |
Ash Wilson | a5b1a14 | 2014-10-22 10:16:03 -0400 | [diff] [blame] | 11 | ) |
| 12 | |
| 13 | func TestListExtensions(t *testing.T) { |
| 14 | client, err := newClient() |
| 15 | th.AssertNoErr(t, err) |
| 16 | |
| 17 | err = extensions.List(client).EachPage(func(page pagination.Page) (bool, error) { |
| 18 | t.Logf("--- Page ---") |
| 19 | |
| 20 | exts, err := extensions.ExtractExtensions(page) |
| 21 | th.AssertNoErr(t, err) |
| 22 | |
| 23 | for i, ext := range exts { |
| 24 | t.Logf("[%02d] name=[%s]\n", i, ext.Name) |
| 25 | t.Logf(" alias=[%s]\n", ext.Alias) |
| 26 | t.Logf(" description=[%s]\n", ext.Description) |
| 27 | } |
| 28 | |
| 29 | return true, nil |
| 30 | }) |
| 31 | th.AssertNoErr(t, err) |
| 32 | } |
| 33 | |
| 34 | func TestGetExtension(t *testing.T) { |
| 35 | client, err := newClient() |
| 36 | th.AssertNoErr(t, err) |
| 37 | |
| 38 | ext, err := extensions.Get(client, "os-admin-actions").Extract() |
| 39 | th.AssertNoErr(t, err) |
| 40 | |
| 41 | t.Logf("Extension details:") |
| 42 | t.Logf(" name=[%s]\n", ext.Name) |
| 43 | t.Logf(" namespace=[%s]\n", ext.Namespace) |
| 44 | t.Logf(" alias=[%s]\n", ext.Alias) |
| 45 | t.Logf(" description=[%s]\n", ext.Description) |
| 46 | t.Logf(" updated=[%s]\n", ext.Updated) |
| 47 | } |