summaryrefslogtreecommitdiff
path: root/openstackclient/tests
diff options
context:
space:
mode:
authorHuanxuan Ao <huanxuan.ao@easystack.cn>2016-06-28 15:54:13 +0800
committerHuanxuan Ao <huanxuan.ao@easystack.cn>2016-06-28 08:12:40 +0000
commit4e46c04f921c81927ded78f17fd28d5a55ebf9e2 (patch)
treedb9c4ab7ecbcd7c066da5c71828e308248651015 /openstackclient/tests
parent9e47688e5eb2d3e4ee8fe0e15d49b34fe7c5512d (diff)
downloadpython-openstackclient-4e46c04f921c81927ded78f17fd28d5a55ebf9e2.tar.gz
Add "--force" option to "volume qos delete" command
Add ``--force`` option to ``volume qos delete`` command in volume v1 and v2 to allow users to delete in-use QoS specification(s). Change-Id: I46036e5f55ced8b8a1be54c521f2a5c242b89160 Closes-Bug: #1596821
Diffstat (limited to 'openstackclient/tests')
-rw-r--r--openstackclient/tests/volume/v1/test_qos_specs.py20
-rw-r--r--openstackclient/tests/volume/v2/test_qos_specs.py18
2 files changed, 35 insertions, 3 deletions
diff --git a/openstackclient/tests/volume/v1/test_qos_specs.py b/openstackclient/tests/volume/v1/test_qos_specs.py
index 392017c6..4e1733fd 100644
--- a/openstackclient/tests/volume/v1/test_qos_specs.py
+++ b/openstackclient/tests/volume/v1/test_qos_specs.py
@@ -211,7 +211,7 @@ class TestQosDelete(TestQos):
result = self.cmd.take_action(parsed_args)
- self.qos_mock.delete.assert_called_with(volume_fakes.qos_id)
+ self.qos_mock.delete.assert_called_with(volume_fakes.qos_id, False)
self.assertIsNone(result)
def test_qos_delete_with_name(self):
@@ -225,7 +225,23 @@ class TestQosDelete(TestQos):
result = self.cmd.take_action(parsed_args)
- self.qos_mock.delete.assert_called_with(volume_fakes.qos_id)
+ self.qos_mock.delete.assert_called_with(volume_fakes.qos_id, False)
+ self.assertIsNone(result)
+
+ def test_qos_delete_with_force(self):
+ arglist = [
+ '--force',
+ volume_fakes.qos_id
+ ]
+ verifylist = [
+ ('force', True),
+ ('qos_specs', [volume_fakes.qos_id])
+ ]
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+
+ result = self.cmd.take_action(parsed_args)
+
+ self.qos_mock.delete.assert_called_with(volume_fakes.qos_id, True)
self.assertIsNone(result)
diff --git a/openstackclient/tests/volume/v2/test_qos_specs.py b/openstackclient/tests/volume/v2/test_qos_specs.py
index 11047535..92ffca74 100644
--- a/openstackclient/tests/volume/v2/test_qos_specs.py
+++ b/openstackclient/tests/volume/v2/test_qos_specs.py
@@ -175,7 +175,23 @@ class TestQosDelete(TestQos):
result = self.cmd.take_action(parsed_args)
- self.qos_mock.delete.assert_called_with(self.qos_spec.id)
+ self.qos_mock.delete.assert_called_with(self.qos_spec.id, False)
+ self.assertIsNone(result)
+
+ def test_qos_delete_with_force(self):
+ arglist = [
+ '--force',
+ self.qos_spec.id
+ ]
+ verifylist = [
+ ('force', True),
+ ('qos_specs', [self.qos_spec.id])
+ ]
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+
+ result = self.cmd.take_action(parsed_args)
+
+ self.qos_mock.delete.assert_called_with(self.qos_spec.id, True)
self.assertIsNone(result)