@@ -900,6 +900,56 @@ def test_quota_set_with_class(self):
900900 self .assertNotCalled (self .network_mock .update_quota )
901901 self .assertIsNone (result )
902902
903+ def test_quota_set_with_force (self ):
904+ arglist = [
905+ '--cores' , str (compute_fakes .core_num ),
906+ '--ram' , str (compute_fakes .ram_num ),
907+ '--instances' , str (compute_fakes .instance_num ),
908+ '--volumes' , str (volume_fakes .QUOTA ['volumes' ]),
909+ '--subnets' , str (network_fakes .QUOTA ['subnet' ]),
910+ '--force' ,
911+ self .projects [0 ].name ,
912+ ]
913+ verifylist = [
914+ ('cores' , compute_fakes .core_num ),
915+ ('ram' , compute_fakes .ram_num ),
916+ ('instances' , compute_fakes .instance_num ),
917+ ('volumes' , volume_fakes .QUOTA ['volumes' ]),
918+ ('subnet' , network_fakes .QUOTA ['subnet' ]),
919+ ('force' , True ),
920+ ('project' , self .projects [0 ].name ),
921+ ]
922+ self .app .client_manager .network_endpoint_enabled = True
923+ parsed_args = self .check_parser (self .cmd , arglist , verifylist )
924+
925+ result = self .cmd .take_action (parsed_args )
926+
927+ kwargs_compute = {
928+ 'cores' : compute_fakes .core_num ,
929+ 'ram' : compute_fakes .ram_num ,
930+ 'instances' : compute_fakes .instance_num ,
931+ 'force' : True ,
932+ }
933+ kwargs_volume = {
934+ 'volumes' : volume_fakes .QUOTA ['volumes' ],
935+ }
936+ kwargs_network = {
937+ 'subnet' : network_fakes .QUOTA ['subnet' ],
938+ }
939+ self .compute_quotas_mock .update .assert_called_once_with (
940+ self .projects [0 ].id ,
941+ ** kwargs_compute
942+ )
943+ self .volume_quotas_mock .update .assert_called_once_with (
944+ self .projects [0 ].id ,
945+ ** kwargs_volume
946+ )
947+ self .network_mock .update_quota .assert_called_once_with (
948+ self .projects [0 ].id ,
949+ ** kwargs_network
950+ )
951+ self .assertIsNone (result )
952+
903953
904954class TestQuotaShow (TestQuota ):
905955
0 commit comments