#NEWLINE# @ mock . patch . object ( ssh , '_get_connection' , autospec = True ) #NEWLINE# @ mock . patch . object ( ssh , '_get_hosts_name_for_node' , autospec = True ) #NEWLINE# @ mock . patch . object ( ssh , '_ssh_execute' , autospec = True ) #NEWLINE# @ mock . patch . object ( ssh , '_get_power_status' , autospec = True ) #NEWLINE# def test_start_command_xenserver( self , mock_power , mock_exc , mock_h , mock_get_conn ) : #NEWLINE# #INDENT# mock_power . side_effect = [ states . POWER_OFF , states . POWER_ON ] #NEWLINE# nodename = 'fakevm' #NEWLINE# mock_h . return_value = nodename #NEWLINE# mock_get_conn . return_value = mock_h . sshclient #NEWLINE# with task_manager . acquire ( self . context , self . node . uuid ) as task : #NEWLINE# #INDENT# task . node [ 'driver_info' ] [ 'ssh_virt_type' ] = 'xenserver' #NEWLINE# self . driver . power . set_power_state ( task , states . POWER_ON ) #NEWLINE# #UNINDENT# expected_cmd = 'LC_ALL=C /opt/xensource/bin/xe vm-start uuid=fakevm && sleep 10s' #NEWLINE# mock_exc . assert_called_once_with ( mock . ANY , expected_cmd )