blob: 1356ffa899845420439a6bebfd6cd9abee3b75a1 [file] [log] [blame]
Ash Wilsona5b1a142014-10-22 10:16:03 -04001// +build acceptance compute extensionss
2
3package v2
4
5import (
6 "testing"
7
8 "github.com/rackspace/gophercloud/openstack/compute/v2/extensions"
9 "github.com/rackspace/gophercloud/pagination"
10 th "github.com/rackspace/gophercloud/testhelper"
11)
12
13func 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
34func 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}