#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# def test_management_interface_get_boot_device_xenserver( self , mock_exc , mock_h , mock_get_conn ) : #NEWLINE# #INDENT# fake_name = 'fake-name' #NEWLINE# mock_h . return_value = result #NEWLINE# mock_exc . return_value = ( 'n' , '' ) #NEWLINE# mock_get_conn . return_value = self . sshclient #NEWLINE# with task_manager . acquire ( self . context , self . node . uuid ) as task : #NEWLINE# #INDENT# task . node [ 'driver_info' ] [ 'ssh_virt_type' ] = 'xenserver' #NEWLINE# result = self . driver . management . get_boot_device ( task ) #NEWLINE# self . assertEqual ( boot_devices . PXE , result [ 'boot_device' ] ) #NEWLINE# #UNINDENT# expected_cmd = ( 'LC_ALL=C /opt/xensource/bin/xe vm-param-get uuid=%s --param-name=HVM-boot-params param-key=order | cut -b 1' % fake_name ) #NEWLINE# mock_exc . assert_called_once_with ( mock . ANY , expected_cmd )