From ba06bc9b228a4e654b998c5920c93bbc703ee7b5 Mon Sep 17 00:00:00 2001 From: Brian Curtin Date: Fri, 27 Feb 2015 12:52:16 -0600 Subject: [PATCH] Adjust paginate argument usage When we changed the default from paginating list to not paginating list, a few other uses of the argument were not updated for that swap. However, since the default turned to False, nothing actually broke in IRL quick tests, but anything that required pagination would not have been returning the full amount of data. Additionally, during that change, the argument name went from paginate to paginated and wasn't fully changed to match up. Change-Id: Id69f27ed30beb55eff96700f05075852525f936f --- openstack/compute/v2/_proxy.py | 6 +++--- openstack/tests/compute/v2/test_proxy.py | 13 ++++++------- openstack/tests/test_proxy_base.py | 3 ++- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/openstack/compute/v2/_proxy.py b/openstack/compute/v2/_proxy.py index dc753847..7f44d3da 100644 --- a/openstack/compute/v2/_proxy.py +++ b/openstack/compute/v2/_proxy.py @@ -54,7 +54,7 @@ class Proxy(object): :returns: A generator of flavor objects """ flv = flavor.FlavorDetail if details else flavor.Flavor - return flv.list(self.session, paginate=False, **params) + return flv.list(self.session, **params) def update_flavor(self, **data): return flavor.Flavor(data).update(self.session) @@ -79,7 +79,7 @@ class Proxy(object): :returns: A generator of image objects """ img = image.ImageDetail if details else image.Image - return img.list(self.session, paginate=False) + return img.list(self.session, paginated=True) def create_keypair(self, **data): return keypair.Keypair(data).create(self.session) @@ -122,7 +122,7 @@ class Proxy(object): return server.Server(data).get(self.session) def list_servers(self): - return server.Server.list(self.session) + return server.Server.list(self.session, paginated=True) def update_server(self, **data): return server.Server(data).update(self.session) diff --git a/openstack/tests/compute/v2/test_proxy.py b/openstack/tests/compute/v2/test_proxy.py index aad46edd..fb2a91d2 100644 --- a/openstack/tests/compute/v2/test_proxy.py +++ b/openstack/tests/compute/v2/test_proxy.py @@ -46,14 +46,12 @@ class TestComputeProxy(test_proxy_base.TestProxyBase): def test_flavor_list_basic(self): self.verify_list('openstack.compute.v2.flavor.Flavor.list', self.proxy.list_flavors, - method_kwargs={"details": False}, - expected_kwargs={"paginate": False}) + method_kwargs={"details": False}) def test_flavor_list_detail(self): self.verify_list('openstack.compute.v2.flavor.FlavorDetail.list', self.proxy.list_flavors, - method_kwargs={"details": True}, - expected_kwargs={"paginate": False}) + method_kwargs={"details": True}) def test_flavor_update(self): self.verify_update('openstack.compute.v2.flavor.Flavor.update', @@ -75,13 +73,13 @@ class TestComputeProxy(test_proxy_base.TestProxyBase): self.verify_list('openstack.compute.v2.image.Image.list', self.proxy.list_images, method_kwargs={"details": False}, - expected_kwargs={"paginate": False}) + expected_kwargs={"paginated": True}) def test_image_list_detail(self): self.verify_list('openstack.compute.v2.image.ImageDetail.list', self.proxy.list_images, method_kwargs={"details": True}, - expected_kwargs={"paginate": False}) + expected_kwargs={"paginated": True}) def test_keypair_create(self): self.verify_create('openstack.compute.v2.keypair.Keypair.create', @@ -168,7 +166,8 @@ class TestComputeProxy(test_proxy_base.TestProxyBase): def test_server_list(self): self.verify_list('openstack.compute.v2.server.Server.list', - self.proxy.list_servers) + self.proxy.list_servers, + expected_kwargs={"paginated": True}) def test_server_update(self): self.verify_update('openstack.compute.v2.server.Server.update', diff --git a/openstack/tests/test_proxy_base.py b/openstack/tests/test_proxy_base.py index b1daccde..60424121 100644 --- a/openstack/tests/test_proxy_base.py +++ b/openstack/tests/test_proxy_base.py @@ -26,7 +26,8 @@ class TestProxyBase(base.TestCase): expected_result=None): with mock.patch(mock_method) as mocked: mocked.return_value = expected_result - if any([method_args, method_kwargs]): + if any([method_args, method_kwargs, + expected_args, expected_kwargs]): method_args = method_args or () method_kwargs = method_kwargs or {} expected_args = expected_args or ()