#NEWLINE# @ mock . patch . object ( common , 'get_instance' , return_value = 'instance' ) #NEWLINE# @ mock . patch . object ( compute . api . API , 'rescue' ) #NEWLINE# def _make_rescue_request_with_image_ref( self , body , mock_rescue , mock_get_instance ) : #NEWLINE# #INDENT# instance = 'instance' #NEWLINE# self . controller . _get_instance = mock . Mock ( return_value = instance ) #NEWLINE# fake_context = context . RequestContext ( 'fake' , 'fake' ) #NEWLINE# req = FakeRequest ( fake_context ) #NEWLINE# self . controller . _rescue ( fake_context , 'id' , body ) #NEWLINE# rescue_image_ref = body [ 'rescue' ] . get ( 'rescue_image_ref' ) #NEWLINE# mock_rescue . assert_called_with ( mock . ANY , mock . ANY , rescue_password = mock . ANY , rescue_image_ref = rescue_image_ref )