diff options
Diffstat (limited to 'cinderclient/tests/unit')
| -rw-r--r-- | cinderclient/tests/unit/v2/test_shell.py | 31 | ||||
| -rw-r--r-- | cinderclient/tests/unit/v2/test_volumes.py | 26 | ||||
| -rw-r--r-- | cinderclient/tests/unit/v3/test_shell.py | 15 |
3 files changed, 2 insertions, 70 deletions
diff --git a/cinderclient/tests/unit/v2/test_shell.py b/cinderclient/tests/unit/v2/test_shell.py index 22cb25e..a610753 100644 --- a/cinderclient/tests/unit/v2/test_shell.py +++ b/cinderclient/tests/unit/v2/test_shell.py @@ -219,37 +219,11 @@ class ShellTest(utils.TestCase): mock_print.assert_called_once_with(mock.ANY, key_list, exclude_unavailable=True, sortby_index=0) - def test_list_sort_valid(self): - self.run_command('list --sort_key=id --sort_dir=asc') - self.assert_called('GET', '/volumes/detail?sort_dir=asc&sort_key=id') - - def test_list_sort_key_name(self): - # Client 'name' key is mapped to 'display_name' - self.run_command('list --sort_key=name') - self.assert_called('GET', '/volumes/detail?sort_key=display_name') - def test_list_sort_name(self): # Client 'name' key is mapped to 'display_name' self.run_command('list --sort=name') self.assert_called('GET', '/volumes/detail?sort=display_name') - def test_list_sort_key_invalid(self): - self.assertRaises(ValueError, - self.run_command, - 'list --sort_key=foo --sort_dir=asc') - - def test_list_sort_dir_invalid(self): - self.assertRaises(ValueError, - self.run_command, - 'list --sort_key=id --sort_dir=foo') - - def test_list_mix_sort_args(self): - cmds = ['list --sort name:desc --sort_key=status', - 'list --sort name:desc --sort_dir=asc', - 'list --sort name:desc --sort_key=status --sort_dir=asc'] - for cmd in cmds: - self.assertRaises(exceptions.CommandError, self.run_command, cmd) - def test_list_sort_single_key_only(self): self.run_command('list --sort=id') self.assert_called('GET', '/volumes/detail?sort=id') @@ -277,10 +251,7 @@ class ShellTest(utils.TestCase): def test_list_reorder_with_sort(self): # sortby_index is None if there is sort information - for cmd in ['list --sort_key=name', - 'list --sort_dir=asc', - 'list --sort_key=name --sort_dir=asc', - 'list --sort=name', + for cmd in ['list --sort=name', 'list --sort=name:asc']: with mock.patch('cinderclient.utils.print_list') as mock_print: self.run_command(cmd) diff --git a/cinderclient/tests/unit/v2/test_volumes.py b/cinderclient/tests/unit/v2/test_volumes.py index 8704c66..e4f9e32 100644 --- a/cinderclient/tests/unit/v2/test_volumes.py +++ b/cinderclient/tests/unit/v2/test_volumes.py @@ -29,19 +29,6 @@ class VolumesTest(utils.TestCase): cs.assert_called('GET', '/volumes/detail?limit=2&marker=1234') self._assert_request_id(lst) - def test_list_volumes_with_sort_key_dir(self): - lst = cs.volumes.list(sort_key='id', sort_dir='asc') - cs.assert_called('GET', '/volumes/detail?sort_dir=asc&sort_key=id') - self._assert_request_id(lst) - - def test_list_volumes_with_invalid_sort_key(self): - self.assertRaises(ValueError, - cs.volumes.list, sort_key='invalid', sort_dir='asc') - - def test_list_volumes_with_invalid_sort_dir(self): - self.assertRaises(ValueError, - cs.volumes.list, sort_key='id', sort_dir='invalid') - def test__list(self): # There only 2 volumes available for our tests, so we set limit to 2. limit = 2 @@ -345,21 +332,10 @@ class FormatSortParamTestCase(utils.TestCase): self.assertEqual('id:asc,status,size:desc', cs.volumes._format_sort_param(s)) - def test_format_sort_list_of_tuples(self): - s = [('id', 'asc'), 'status', ('size', 'desc')] - self.assertEqual('id:asc,status,size:desc', - cs.volumes._format_sort_param(s)) - - def test_format_sort_list_of_strings_and_tuples(self): - s = [('id', 'asc'), 'status', 'size:desc'] - self.assertEqual('id:asc,status,size:desc', - cs.volumes._format_sort_param(s)) - def test_format_sort_invalid_direction(self): for s in ['id:foo', 'id:asc,status,size:foo', - ['id', 'status', 'size:foo'], - ['id', 'status', ('size', 'foo')]]: + ['id', 'status', 'size:foo']]: self.assertRaises(ValueError, cs.volumes._format_sort_param, s) diff --git a/cinderclient/tests/unit/v3/test_shell.py b/cinderclient/tests/unit/v3/test_shell.py index 8969cab..ee35ddf 100644 --- a/cinderclient/tests/unit/v3/test_shell.py +++ b/cinderclient/tests/unit/v3/test_shell.py @@ -1438,21 +1438,6 @@ class ShellTest(utils.TestCase): }} self.assert_called('POST', '/volume-transfers', body=expected) - def test_list_transfer_sort_key(self): - self.run_command( - '--os-volume-api-version 3.59 transfer-list --sort=id') - url = ('/volume-transfers/detail?%s' % - parse.urlencode([('sort_key', 'id')])) - self.assert_called('GET', url) - - def test_list_transfer_sort_key_dir(self): - self.run_command( - '--os-volume-api-version 3.59 transfer-list --sort=id:asc') - url = ('/volume-transfers/detail?%s' % - parse.urlencode([('sort_dir', 'asc'), - ('sort_key', 'id')])) - self.assert_called('GET', url) - def test_list_transfer_sorty_not_sorty(self): self.run_command( '--os-volume-api-version 3.59 transfer-list') |
