summaryrefslogtreecommitdiff
path: root/cinderclient/tests/unit
diff options
context:
space:
mode:
authorwangxiyuan <wangxiyuan@huawei.com>2017-06-15 09:39:50 +0800
committerwangxiyuan <wangxiyuan@huawei.com>2017-07-12 09:18:31 +0800
commita570f26d97cde31d1dfb734fd2f8d2fff7a054f5 (patch)
treec8b4e4356836212d5d6085bad88d0ec76a2e15ca /cinderclient/tests/unit
parent6a00d30e966d5fbd24cc8817afae32d9969adfb5 (diff)
downloadpython-cinderclient-a570f26d97cde31d1dfb734fd2f8d2fff7a054f5.tar.gz
Support volume summary command
This patch added volume summary command support. Change-Id: I7cf6e149b9ce9cae21818c60146e6db9cc2904bd
Diffstat (limited to 'cinderclient/tests/unit')
-rw-r--r--cinderclient/tests/unit/v3/fakes.py9
-rw-r--r--cinderclient/tests/unit/v3/test_shell.py4
-rw-r--r--cinderclient/tests/unit/v3/test_volumes.py8
3 files changed, 21 insertions, 0 deletions
diff --git a/cinderclient/tests/unit/v3/fakes.py b/cinderclient/tests/unit/v3/fakes.py
index c06ca3e..b02d079 100644
--- a/cinderclient/tests/unit/v3/fakes.py
+++ b/cinderclient/tests/unit/v3/fakes.py
@@ -557,6 +557,15 @@ class FakeHTTPClient(fake_v2.FakeHTTPClient):
'levels': {'prefix3': 'WARNING', 'prefix4': 'ERROR'}}]
return (200, {}, {'log_levels': levels})
+ def get_volumes_summary(self, **kw):
+ return 200, {}, {"volume-summary": {'total_size': 5,
+ 'total_count': 5,
+ 'metadata': {
+ "test_key": ["test_value"]
+ }
+ }
+ }
+
#
# resource filters
#
diff --git a/cinderclient/tests/unit/v3/test_shell.py b/cinderclient/tests/unit/v3/test_shell.py
index 96dd7cf..6f2d86b 100644
--- a/cinderclient/tests/unit/v3/test_shell.py
+++ b/cinderclient/tests/unit/v3/test_shell.py
@@ -204,6 +204,10 @@ class ShellTest(utils.TestCase):
# NOTE(jdg): we default to detail currently
self.assert_called('GET', '/volumes/detail')
+ def test_summary(self):
+ self.run_command('--os-volume-api-version 3.12 summary')
+ self.assert_called('GET', '/volumes/summary')
+
def test_list_with_group_id_before_3_10(self):
self.assertRaises(exceptions.UnsupportedAttribute,
self.run_command,
diff --git a/cinderclient/tests/unit/v3/test_volumes.py b/cinderclient/tests/unit/v3/test_volumes.py
index 5eb9750..72ef916 100644
--- a/cinderclient/tests/unit/v3/test_volumes.py
+++ b/cinderclient/tests/unit/v3/test_volumes.py
@@ -94,6 +94,14 @@ class VolumesTest(utils.TestCase):
cs.assert_called('POST', '/volumes', body=expected)
self._assert_request_id(vol)
+ @ddt.data((False, '/volumes/summary'),
+ (True, '/volumes/summary?all_tenants=True'))
+ def test_volume_summary(self, all_tenants_input):
+ all_tenants, url = all_tenants_input
+ cs = fakes.FakeClient(api_versions.APIVersion('3.12'))
+ cs.volumes.summary(all_tenants=all_tenants)
+ cs.assert_called('GET', url)
+
def test_volume_list_manageable(self):
cs = fakes.FakeClient(api_versions.APIVersion('3.8'))
cs.volumes.list_manageable('host1', detailed=False)