Unit test for the Extract function.
diff --git a/openstack/compute/v2/extensions/diskconfig/results_test.go b/openstack/compute/v2/extensions/diskconfig/results_test.go
index adbd031..dd8d2b7 100644
--- a/openstack/compute/v2/extensions/diskconfig/results_test.go
+++ b/openstack/compute/v2/extensions/diskconfig/results_test.go
@@ -4,6 +4,7 @@
"testing"
"github.com/rackspace/gophercloud/openstack/compute/v2/servers"
+ "github.com/rackspace/gophercloud/pagination"
th "github.com/rackspace/gophercloud/testhelper"
"github.com/rackspace/gophercloud/testhelper/client"
)
@@ -46,3 +47,22 @@
th.AssertNoErr(t, err)
th.CheckEquals(t, Manual, *config)
}
+
+func TestExtractList(t *testing.T) {
+ th.SetupHTTP()
+ defer th.TeardownHTTP()
+ servers.HandleServerListSuccessfully(t)
+
+ pages := 0
+ err := servers.List(client.ServiceClient(), nil).EachPage(func(page pagination.Page) (bool, error) {
+ pages++
+
+ config, err := ExtractDiskConfig(page, 0)
+ th.AssertNoErr(t, err)
+ th.CheckEquals(t, Manual, *config)
+
+ return true, nil
+ })
+ th.AssertNoErr(t, err)
+ th.CheckEquals(t, pages, 1)
+}