#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_set_boot_device_virsh_ok( self , mock_exc , mock_h , mock_get_conn ) : #NEWLINE# #INDENT# fake_name = 'fake-name' #NEWLINE# mock_h . return_value = fake_name #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' ] = 'virsh' #NEWLINE# self . driver . management . set_boot_device ( task , boot_devices . PXE ) #NEWLINE# #UNINDENT# expected_cmd = ( 'EDITOR="sed -i \'/<boot \\(dev\\|order\\)=*\\>/d;/<\\/os>/i\\<boot dev=\\"network\\"/>\'" LC_ALL=C /usr/bin/virsh --connect qemu:///system edit %s' % fake_name ) #NEWLINE# mock_exc . assert_called_once_with ( mock . ANY , expected_cmd )