summaryrefslogtreecommitdiff
path: root/openstackclient/tests
diff options
context:
space:
mode:
Diffstat (limited to 'openstackclient/tests')
-rw-r--r--openstackclient/tests/functional/volume/v1/test_qos.py16
-rw-r--r--openstackclient/tests/functional/volume/v2/test_qos.py16
-rw-r--r--openstackclient/tests/functional/volume/v3/test_qos.py16
-rw-r--r--openstackclient/tests/unit/volume/v1/test_qos_specs.py16
-rw-r--r--openstackclient/tests/unit/volume/v2/test_qos_specs.py15
5 files changed, 56 insertions, 23 deletions
diff --git a/openstackclient/tests/functional/volume/v1/test_qos.py b/openstackclient/tests/functional/volume/v1/test_qos.py
index cabcd19e..5d0aa41f 100644
--- a/openstackclient/tests/functional/volume/v1/test_qos.py
+++ b/openstackclient/tests/functional/volume/v1/test_qos.py
@@ -52,8 +52,10 @@ class QosTests(common.BaseVolumeTests):
name = uuid.uuid4().hex
cmd_output = self.openstack(
- 'volume qos create ' + '--consumer front-end '
- '--property Alpha=a ' + name,
+ 'volume qos create '
+ + '--consumer front-end '
+ + '--property Alpha=a '
+ + name,
parse_output=True,
)
self.addCleanup(self.openstack, 'volume qos delete ' + name)
@@ -64,8 +66,9 @@ class QosTests(common.BaseVolumeTests):
# Test volume qos set
raw_output = self.openstack(
'volume qos set '
- + '--property Alpha=c '
+ + '--no-property '
+ '--property Beta=b '
+ + '--property Charlie=c '
+ name,
)
self.assertOutput('', raw_output)
@@ -76,11 +79,14 @@ class QosTests(common.BaseVolumeTests):
parse_output=True,
)
self.assertEqual(name, cmd_output['name'])
- self.assertEqual({'Alpha': 'c', 'Beta': 'b'}, cmd_output['properties'])
+ self.assertEqual(
+ {'Beta': 'b', 'Charlie': 'c'},
+ cmd_output['properties'],
+ )
# Test volume qos unset
raw_output = self.openstack(
- 'volume qos unset ' + '--property Alpha ' + name,
+ 'volume qos unset ' + '--property Charlie ' + name,
)
self.assertOutput('', raw_output)
diff --git a/openstackclient/tests/functional/volume/v2/test_qos.py b/openstackclient/tests/functional/volume/v2/test_qos.py
index 4f07084a..fc4c52de 100644
--- a/openstackclient/tests/functional/volume/v2/test_qos.py
+++ b/openstackclient/tests/functional/volume/v2/test_qos.py
@@ -52,8 +52,10 @@ class QosTests(common.BaseVolumeTests):
name = uuid.uuid4().hex
cmd_output = self.openstack(
- 'volume qos create ' + '--consumer front-end '
- '--property Alpha=a ' + name,
+ 'volume qos create '
+ + '--consumer front-end '
+ + '--property Alpha=a '
+ + name,
parse_output=True,
)
self.addCleanup(self.openstack, 'volume qos delete ' + name)
@@ -65,8 +67,9 @@ class QosTests(common.BaseVolumeTests):
# Test volume qos set
raw_output = self.openstack(
'volume qos set '
- + '--property Alpha=c '
+ + '--no-property '
+ '--property Beta=b '
+ + '--property Charlie=c '
+ name,
)
self.assertOutput('', raw_output)
@@ -77,11 +80,14 @@ class QosTests(common.BaseVolumeTests):
parse_output=True,
)
self.assertEqual(name, cmd_output['name'])
- self.assertEqual({'Alpha': 'c', 'Beta': 'b'}, cmd_output['properties'])
+ self.assertEqual(
+ {'Beta': 'b', 'Charlie': 'c'},
+ cmd_output['properties'],
+ )
# Test volume qos unset
raw_output = self.openstack(
- 'volume qos unset ' + '--property Alpha ' + name,
+ 'volume qos unset ' + '--property Charlie ' + name,
)
self.assertOutput('', raw_output)
diff --git a/openstackclient/tests/functional/volume/v3/test_qos.py b/openstackclient/tests/functional/volume/v3/test_qos.py
index 2a09e549..54dffbc0 100644
--- a/openstackclient/tests/functional/volume/v3/test_qos.py
+++ b/openstackclient/tests/functional/volume/v3/test_qos.py
@@ -52,8 +52,10 @@ class QosTests(common.BaseVolumeTests):
name = uuid.uuid4().hex
cmd_output = self.openstack(
- 'volume qos create ' + '--consumer front-end '
- '--property Alpha=a ' + name,
+ 'volume qos create '
+ + '--consumer front-end '
+ + '--property Alpha=a '
+ + name,
parse_output=True,
)
self.addCleanup(self.openstack, 'volume qos delete ' + name)
@@ -65,8 +67,9 @@ class QosTests(common.BaseVolumeTests):
# Test volume qos set
raw_output = self.openstack(
'volume qos set '
- + '--property Alpha=c '
+ + '--no-property '
+ '--property Beta=b '
+ + '--property Charlie=c '
+ name,
)
self.assertOutput('', raw_output)
@@ -77,11 +80,14 @@ class QosTests(common.BaseVolumeTests):
parse_output=True,
)
self.assertEqual(name, cmd_output['name'])
- self.assertEqual({'Alpha': 'c', 'Beta': 'b'}, cmd_output['properties'])
+ self.assertEqual(
+ {'Beta': 'b', 'Charlie': 'c'},
+ cmd_output['properties'],
+ )
# Test volume qos unset
raw_output = self.openstack(
- 'volume qos unset ' + '--property Alpha ' + name,
+ 'volume qos unset ' + '--property Charlie ' + name,
)
self.assertOutput('', raw_output)
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)