#NEWLINE# @ mock . patch ( 'neutron.plugins.ml2.drivers.mech_sriov.agent.pci_lib.PciDeviceIPWrapper.get_assigned_macs' , return_value = [ ( DEVICE_MAC , PCI_SLOT ) ] ) #NEWLINE# @ mock . patch ( 'neutron.plugins.ml2.drivers.mech_sriov.agent.eswitch_manager.PciOsWrapper.is_assigned_vf' , return_value = True ) #NEWLINE# def test_treat_devices_removed_failed( self , * args ) : #NEWLINE# #INDENT# agent = sriov_nic_agent . SriovNicSwitchAgent ( { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , 0 ) #NEWLINE# devices = [ ( DEVICE_MAC , PCI_SLOT ) ] #NEWLINE# with mock . patch . object ( agent . plugin_rpc , 'update_device_down' ) as fn_udd : #NEWLINE# #INDENT# fn_udd . side_effect = Exception ( ) #NEWLINE# with mock . patch . object ( sriov_nic_agent . LOG , 'debug' ) as log : #NEWLINE# #INDENT# resync = agent . treat_devices_removed ( devices ) #NEWLINE# self . assertEqual ( 1 , log . call_count ) #NEWLINE# self . assertTrue ( resync ) #NEWLINE# self . assertTrue ( fn_udd . called )