#NEWLINE# @ mock . patch . object ( vmops . VMOps , '_get_vif_driver' ) #NEWLINE# def test_detach_and_destroy_interface( self , mock_get_vif_driver ) : #NEWLINE# #INDENT# fake_vm = fake_instance . fake_instance_obj ( self . context ) #NEWLINE# fake_vif = test_virtual_interface . fake_vif #NEWLINE# fake_vif [ 'type' ] = mock . sentinel . VIF_TYPE #NEWLINE# fake_vif_driver = mock_get_vif_driver . return_value #NEWLINE# self . _vmops . _detach_and_destroy_interface ( fake_vm , fake_vif ) #NEWLINE# fake_vif_driver . unplug . assert_called_once_with ( fake_vm , fake_vif ) #NEWLINE# self . _vmops . _vmutils . destroy_nic . assert_called_once_with ( fake_vm . name , fake_vif [ 'id' ] )