fix images 'AllPages' paging (#266)
* fix images AllPages paging; make AllPages more robust
* need to keep using the local page when iterating in AllPages
diff --git a/openstack/imageservice/v2/images/testing/requests_test.go b/openstack/imageservice/v2/images/testing/requests_test.go
index 788eec4..fdd8402 100644
--- a/openstack/imageservice/v2/images/testing/requests_test.go
+++ b/openstack/imageservice/v2/images/testing/requests_test.go
@@ -44,6 +44,19 @@
th.AssertEquals(t, 3, count)
}
+func TestAllPagesImage(t *testing.T) {
+ th.SetupHTTP()
+ defer th.TeardownHTTP()
+
+ HandleImageListSuccessfully(t)
+
+ pages, err := images.List(fakeclient.ServiceClient(), nil).AllPages()
+ th.AssertNoErr(t, err)
+ images, err := images.ExtractImages(pages)
+ th.AssertNoErr(t, err)
+ th.AssertEquals(t, 3, len(images))
+}
+
func TestCreateImage(t *testing.T) {
th.SetupHTTP()
defer th.TeardownHTTP()