summaryrefslogtreecommitdiff
path: root/openstackclient/tests/unit/volume/v1
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-09-11 05:22:58 +0000
committerGerrit Code Review <review@openstack.org>2016-09-11 05:22:58 +0000
commitcc5379b55cc74740b2451b9445bb752d6230862e (patch)
treeb056841d5efc58966a90d4bdf0efde890e84fd7a /openstackclient/tests/unit/volume/v1
parentf5c09fe24650626686c03426103a01e59ba7aa3d (diff)
parent6986a32e1cd6d0c0bdf973e5d4e4bcb3d1f45235 (diff)
downloadpython-openstackclient-cc5379b55cc74740b2451b9445bb752d6230862e.tar.gz
Merge "Add "--limit" and "--marker" options to "volume list" command"
Diffstat (limited to 'openstackclient/tests/unit/volume/v1')
-rw-r--r--openstackclient/tests/unit/volume/v1/test_volume.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/openstackclient/tests/unit/volume/v1/test_volume.py b/openstackclient/tests/unit/volume/v1/test_volume.py
index 6a860fd0..54ec9e7e 100644
--- a/openstackclient/tests/unit/volume/v1/test_volume.py
+++ b/openstackclient/tests/unit/volume/v1/test_volume.py
@@ -13,6 +13,7 @@
# under the License.
#
+import argparse
import copy
import mock
from mock import call
@@ -540,6 +541,7 @@ class TestVolumeList(TestVolume):
('all_projects', False),
('name', None),
('status', None),
+ ('limit', None),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@@ -557,6 +559,7 @@ class TestVolumeList(TestVolume):
('all_projects', False),
('name', volume_fakes.volume_name),
('status', None),
+ ('limit', None),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@@ -573,6 +576,7 @@ class TestVolumeList(TestVolume):
('all_projects', False),
('name', None),
('status', volume_fakes.volume_status),
+ ('limit', None),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@@ -589,6 +593,7 @@ class TestVolumeList(TestVolume):
('all_projects', True),
('name', None),
('status', None),
+ ('limit', None),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@@ -605,6 +610,7 @@ class TestVolumeList(TestVolume):
('all_projects', False),
('name', None),
('status', None),
+ ('limit', None),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@@ -635,6 +641,41 @@ class TestVolumeList(TestVolume):
), )
self.assertEqual(datalist, tuple(data))
+ def test_volume_list_with_limit(self):
+ arglist = [
+ '--limit', '2',
+ ]
+ verifylist = [
+ ('long', False),
+ ('all_projects', False),
+ ('name', None),
+ ('status', None),
+ ('limit', 2),
+ ]
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+
+ columns, data = self.cmd.take_action(parsed_args)
+
+ self.volumes_mock.list.assert_called_once_with(
+ limit=2,
+ search_opts={
+ 'status': None,
+ 'display_name': None,
+ 'all_tenants': False, }
+ )
+ self.assertEqual(self.columns, columns)
+ self.assertEqual(self.datalist, tuple(data))
+
+ def test_volume_list_negative_limit(self):
+ arglist = [
+ "--limit", "-2",
+ ]
+ verifylist = [
+ ("limit", -2),
+ ]
+ self.assertRaises(argparse.ArgumentTypeError, self.check_parser,
+ self.cmd, arglist, verifylist)
+
class TestVolumeSet(TestVolume):