diff options
| author | Stephen Finucane <stephenfin@redhat.com> | 2023-05-17 12:27:45 +0100 |
|---|---|---|
| committer | Stephen Finucane <stephenfin@redhat.com> | 2023-05-17 16:50:16 +0100 |
| commit | 629eb33c4dcb73d44d1a4c6105e40d28f6cebdfc (patch) | |
| tree | 485a8b83d670a19d644eab733528c2e29dc1a1aa /openstackclient/tests/unit | |
| parent | 31ae635ffe0a2c37ab2bda394d2b072d7e5acff9 (diff) | |
| download | python-openstackclient-629eb33c4dcb73d44d1a4c6105e40d28f6cebdfc.tar.gz | |
volume: Add 'volume qos set --no-property' option
Supporting "--no-property" option will apply user a convenient way to
clean all properties of volume qos in a short command. The patch adds
"--no-property" option in "volume qos set" command and update related
test cases and docs.
Change-Id: I1fb5b4f0a923bbf557a3af3f63809bde9e84ffd4
Diffstat (limited to 'openstackclient/tests/unit')
| -rw-r--r-- | openstackclient/tests/unit/volume/v1/test_qos_specs.py | 16 | ||||
| -rw-r--r-- | openstackclient/tests/unit/volume/v2/test_qos_specs.py | 15 |
2 files changed, 23 insertions, 8 deletions
diff --git a/openstackclient/tests/unit/volume/v1/test_qos_specs.py b/openstackclient/tests/unit/volume/v1/test_qos_specs.py index 7e26e223..cbfd1fa4 100644 --- a/openstackclient/tests/unit/volume/v1/test_qos_specs.py +++ b/openstackclient/tests/unit/volume/v1/test_qos_specs.py @@ -366,22 +366,30 @@ class TestQosSet(TestQos): def test_qos_set_with_properties_with_id(self): arglist = [ + '--no-property', '--property', - 'foo=bar', + 'a=b', '--property', - 'iops=9001', + 'c=d', self.qos_spec.id, ] + new_property = {"a": "b", "c": "d"} verifylist = [ - ('property', self.qos_spec.specs), + ('no_property', True), + ('property', new_property), ('qos_spec', self.qos_spec.id), ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) result = self.cmd.take_action(parsed_args) + self.qos_mock.unset_keys.assert_called_with( + self.qos_spec.id, + list(self.qos_spec.specs.keys()), + ) self.qos_mock.set_keys.assert_called_with( - self.qos_spec.id, self.qos_spec.specs + self.qos_spec.id, + {"a": "b", "c": "d"}, ) self.assertIsNone(result) diff --git a/openstackclient/tests/unit/volume/v2/test_qos_specs.py b/openstackclient/tests/unit/volume/v2/test_qos_specs.py index 994bcf96..54a13efc 100644 --- a/openstackclient/tests/unit/volume/v2/test_qos_specs.py +++ b/openstackclient/tests/unit/volume/v2/test_qos_specs.py @@ -362,22 +362,29 @@ class TestQosSet(TestQos): def test_qos_set_with_properties_with_id(self): arglist = [ + '--no-property', '--property', - 'foo=bar', + 'a=b', '--property', - 'iops=9001', + 'c=d', self.qos_spec.id, ] + new_property = {"a": "b", "c": "d"} verifylist = [ - ('property', self.qos_spec.specs), + ('no_property', True), + ('property', new_property), ('qos_spec', self.qos_spec.id), ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) result = self.cmd.take_action(parsed_args) + self.qos_mock.unset_keys.assert_called_with( + self.qos_spec.id, + list(self.qos_spec.specs.keys()), + ) self.qos_mock.set_keys.assert_called_with( - self.qos_spec.id, self.qos_spec.specs + self.qos_spec.id, {"a": "b", "c": "d"} ) self.assertIsNone(result) |
