#NEWLINE# def _run_compute_api_method( self , method_name ) : #NEWLINE# #INDENT# instance = fake_instance . fake_instance_obj ( self . ctxt ) #NEWLINE# method_info = { #NEWLINE# #INDENT# 'method' : method_name , #NEWLINE# 'method_args' : ( instance . uuid , 2 , 3 ) , #NEWLINE# 'method_kwargs' : { #NEWLINE# #INDENT# 'arg1' : 'val1' , #NEWLINE# 'arg2' : 'val2' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# expected_attrs = [ 'metadata' , 'system_metadata' , 'security_groups' , 'info_cache' ] #NEWLINE# @ mock . patch . object ( self . tgt_compute_api , method_name , return_value = 'fake-result' ) #NEWLINE# @ mock . patch . object ( objects . Instance , 'get_by_uuid' , return_value = instance ) #NEWLINE# def run_method( mock_get_by_uuid , mock_method ) : #NEWLINE# #INDENT# response = self . src_msg_runner . run_compute_api_method ( self . ctxt , self . tgt_cell_name , method_info , True ) #NEWLINE# result = response . value_or_raise ( ) #NEWLINE# self . assertEqual ( 'fake-result' , result ) #NEWLINE# mock_get_by_uuid . assert_called_once_with ( self . ctxt , instance . uuid , expected_attrs = expected_attrs ) #NEWLINE# mock_method . assert_called_once_with ( self . ctxt , instance , 2 , 3 , arg1 = 'val1' , arg2 = 'val2' ) #NEWLINE# #UNINDENT# run_method ( )