diff options
| author | Zuul <zuul@review.opendev.org> | 2020-09-03 22:01:16 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2020-09-03 22:01:16 +0000 |
| commit | 0566ad66a99a723e7891264d70298b178606ad9e (patch) | |
| tree | 199ba618156ca5837f6df76be2ebc1c06c897a46 /openstackclient/tests/unit | |
| parent | 95cc05bdf6f62f14970a722d09010c4195951671 (diff) | |
| parent | 176907f70eb5b84d15efc03571ca772706a164a6 (diff) | |
| download | python-openstackclient-0566ad66a99a723e7891264d70298b178606ad9e.tar.gz | |
Merge "Allow openstack flavor set to update flavor description using name"
Diffstat (limited to 'openstackclient/tests/unit')
| -rw-r--r-- | openstackclient/tests/unit/compute/v2/test_flavor.py | 36 |
1 files changed, 36 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): |
