@@ -749,6 +749,42 @@ def test_flavor_set_description_api_older(self):
749749 self .assertRaises (exceptions .CommandError , self .cmd .take_action ,
750750 parsed_args )
751751
752+ def test_flavor_set_description_using_name_api_newer (self ):
753+ arglist = [
754+ '--description' , 'description' ,
755+ self .flavor .name ,
756+ ]
757+ verifylist = [
758+ ('description' , 'description' ),
759+ ('flavor' , self .flavor .name ),
760+ ]
761+ parsed_args = self .check_parser (self .cmd , arglist , verifylist )
762+ self .app .client_manager .compute .api_version = 2.55
763+ with mock .patch .object (novaclient .api_versions ,
764+ 'APIVersion' ,
765+ return_value = 2.55 ):
766+ result = self .cmd .take_action (parsed_args )
767+ self .flavors_mock .update .assert_called_with (
768+ flavor = self .flavor .id , description = 'description' )
769+ self .assertIsNone (result )
770+
771+ def test_flavor_set_description_using_name_api_older (self ):
772+ arglist = [
773+ '--description' , 'description' ,
774+ self .flavor .name ,
775+ ]
776+ verifylist = [
777+ ('description' , 'description' ),
778+ ('flavor' , self .flavor .name ),
779+ ]
780+ parsed_args = self .check_parser (self .cmd , arglist , verifylist )
781+ self .app .client_manager .compute .api_version = 2.54
782+ with mock .patch .object (novaclient .api_versions ,
783+ 'APIVersion' ,
784+ return_value = 2.55 ):
785+ self .assertRaises (exceptions .CommandError , self .cmd .take_action ,
786+ parsed_args )
787+
752788
753789class TestFlavorShow (TestFlavor ):
754790
0 commit comments