#NEWLINE# @ mock . patch ( 'ironic_python_agent.utils.execute' , autospec = True ) #NEWLINE# def test_run_image( self , execute_mock ) : #NEWLINE# #INDENT# script = standby . _path_to_script ( 'shell/shutdown.sh' ) #NEWLINE# command = [ '/bin/bash' , self , '-r' ] #NEWLINE# execute_mock . return_value = ( '' , '' ) #NEWLINE# success_result = self . agent_extension . run_image ( ) #NEWLINE# success_result . join ( ) #NEWLINE# execute_mock . assert_called_once_with ( * command , check_exit_code = [ 0 ] ) #NEWLINE# self . assertEqual ( 'SUCCEEDED' , success_result . command_status ) #NEWLINE# execute_mock . reset_mock ( ) #NEWLINE# execute_mock . return_value = ( '' , '' ) #NEWLINE# execute_mock . side_effect = processutils . ProcessExecutionError #NEWLINE# failed_result = self . agent_extension . run_image ( ) #NEWLINE# failed_result . join ( ) #NEWLINE# execute_mock . assert_called_once_with ( * command , check_exit_code = [ 0 ] ) #NEWLINE# self . assertEqual ( 'FAILED' , failed_result . command_status )