#NEWLINE# def test_delete_instance_no_cell_destroy_fails_already_deleted( self ) : #NEWLINE# #INDENT# instance = objects . Instance ( uuid = uuids . destroy_instance , cell_name = None ) #NEWLINE# actionerror = exception . ObjectActionError ( action = 'destroy' , reason = '' ) #NEWLINE# notfound = exception . InstanceNotFound ( instance_id = notfound . uuid ) #NEWLINE# @ mock . patch . object ( compute_api . API , 'delete' ) #NEWLINE# @ mock . patch . object ( self . compute_api . cells_rpcapi , 'instance_delete_everywhere' ) #NEWLINE# @ mock . patch . object ( compute_api . API , '_local_delete' , side_effect = actionerror ) #NEWLINE# @ mock . patch . object ( instance , 'refresh' , side_effect = notfound ) #NEWLINE# def _test( mock_refresh , mock_local_delete , mock_delete_everywhere , mock_compute_delete ) : #NEWLINE# #INDENT# self . compute_api . delete ( self . context , instance ) #NEWLINE# mock_delete_everywhere . assert_called_once_with ( self . context , instance , 'hard' ) #NEWLINE# mock_local_delete . assert_called_once_with ( self . context , instance , mock . ANY , 'delete' , self . compute_api . _do_delete ) #NEWLINE# mock_refresh . assert_called_once_with ( ) #NEWLINE# self . assertFalse ( mock_compute_delete . called ) #NEWLINE# #UNINDENT# _test ( )