#NEWLINE# @ mock . patch ( 'cloudbaseinit.init.InitManager._get_plugin_status' ) #NEWLINE# @ mock . patch ( 'cloudbaseinit.init.InitManager._set_plugin_status' ) #NEWLINE# def _test_exec_plugin( self , status , mock_set_plugin_status , mock_get_plugin_status ) : #NEWLINE# #INDENT# fake_name = 'fake name' #NEWLINE# self . plugin . get_name . return_value = fake_name #NEWLINE# self . plugin . execute . return_value = ( status , True ) #NEWLINE# mock_get_plugin_status . return_value = status #NEWLINE# response = self . _init . _exec_plugin ( osutils = mock_get_plugin_status . osutils , service = 'fake service' , plugin = self . plugin , instance_id = 'fake id' , shared_data = 'shared data' ) #NEWLINE# mock_get_plugin_status . assert_called_once_with ( self . osutils , 'fake id' , fake_name ) #NEWLINE# if ( status is base . PLUGIN_EXECUTE_ON_NEXT_BOOT ) : #NEWLINE# #INDENT# self . plugin . execute . assert_called_once_with ( 'fake service' , 'shared data' ) #NEWLINE# mock_set_plugin_status . assert_called_once_with ( self . osutils , 'fake id' , fake_name , status ) #NEWLINE# self . assertTrue ( response )