#NEWLINE# @ mock . patch ( 'hyperv.nova.vmops.VMOps._wait_for_power_off' ) #NEWLINE# def test_soft_shutdown_wait( self , mock_wait_for_power_off ) : #NEWLINE# #INDENT# instance = fake_instance . fake_instance_obj ( self . context ) #NEWLINE# mock_wait_for_power_off . side_effect = [ False , True ] #NEWLINE# result = self . _vmops . _soft_shutdown ( instance , self . _FAKE_TIMEOUT , 1 ) #NEWLINE# calls = [ mock . call ( instance . name , 1 ) , mock . call ( instance . name , ( self . _FAKE_TIMEOUT - 1 ) ) ] #NEWLINE# mock_shutdown_vm = self . _vmops . _vmutils . soft_shutdown_vm #NEWLINE# mock_shutdown_vm . assert_called_with ( instance . name ) #NEWLINE# mock_wait_for_power_off . assert_has_calls ( calls ) #NEWLINE# self . assertTrue ( result )