summaryrefslogtreecommitdiff
path: root/openstackclient/tests/unit/compute/v2
diff options
context:
space:
mode:
Diffstat (limited to 'openstackclient/tests/unit/compute/v2')
-rw-r--r--openstackclient/tests/unit/compute/v2/test_flavor.py36
-rw-r--r--openstackclient/tests/unit/compute/v2/test_server.py3
2 files changed, 39 insertions, 0 deletions
diff --git a/openstackclient/tests/unit/compute/v2/test_flavor.py b/openstackclient/tests/unit/compute/v2/test_flavor.py
index fe7ce174..4732cc82 100644
--- a/openstackclient/tests/unit/compute/v2/test_flavor.py
+++ b/openstackclient/tests/unit/compute/v2/test_flavor.py
@@ -749,6 +749,42 @@ class TestFlavorSet(TestFlavor):
self.assertRaises(exceptions.CommandError, self.cmd.take_action,
parsed_args)
+ def test_flavor_set_description_using_name_api_newer(self):
+ arglist = [
+ '--description', 'description',
+ self.flavor.name,
+ ]
+ verifylist = [
+ ('description', 'description'),
+ ('flavor', self.flavor.name),
+ ]
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+ self.app.client_manager.compute.api_version = 2.55
+ with mock.patch.object(novaclient.api_versions,
+ 'APIVersion',
+ return_value=2.55):
+ result = self.cmd.take_action(parsed_args)
+ self.flavors_mock.update.assert_called_with(
+ flavor=self.flavor.id, description='description')
+ self.assertIsNone(result)
+
+ def test_flavor_set_description_using_name_api_older(self):
+ arglist = [
+ '--description', 'description',
+ self.flavor.name,
+ ]
+ verifylist = [
+ ('description', 'description'),
+ ('flavor', self.flavor.name),
+ ]
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+ self.app.client_manager.compute.api_version = 2.54
+ with mock.patch.object(novaclient.api_versions,
+ 'APIVersion',
+ return_value=2.55):
+ self.assertRaises(exceptions.CommandError, self.cmd.take_action,
+ parsed_args)
+
class TestFlavorShow(TestFlavor):
diff --git a/openstackclient/tests/unit/compute/v2/test_server.py b/openstackclient/tests/unit/compute/v2/test_server.py
index 405e05d1..2da527c6 100644
--- a/openstackclient/tests/unit/compute/v2/test_server.py
+++ b/openstackclient/tests/unit/compute/v2/test_server.py
@@ -5166,6 +5166,8 @@ class TestServerGeneral(TestServer):
'tenant_id': u'tenant-id-xxx',
'networks': {u'public': [u'10.20.30.40', u'2001:db8::f']},
'links': u'http://xxx.yyy.com',
+ 'properties': '',
+ 'volumes_attached': [{"id": "6344fe9d-ef20-45b2-91a6"}],
}
_server = compute_fakes.FakeServer.create_one_server(attrs=server_info)
find_resource.side_effect = [_server, _flavor]
@@ -5182,6 +5184,7 @@ class TestServerGeneral(TestServer):
'properties': '',
'OS-EXT-STS:power_state': server._format_servers_list_power_state(
getattr(_server, 'OS-EXT-STS:power_state')),
+ 'volumes_attached': [{"id": "6344fe9d-ef20-45b2-91a6"}],
}
# Call _prep_server_detail().