#NEWLINE# def test_get_all_devices( self ) : #NEWLINE# #INDENT# listing = [ 'foo' , 'macvtap0' , 'macvtap1' , 'bar' ] #NEWLINE# self . mgr . mac_device_name_mappings = { #NEWLINE# #INDENT# 'foo' : 'bar' , #NEWLINE# #UNINDENT# } #NEWLINE# with mock . patch . object ( os , 'listdir' , return_value = listing ) as mock_ld , mock . patch . object ( utils , 'get_interface_mac' ) as mock_gdn : #NEWLINE# #INDENT# mock_gdn . side_effect = [ 'mac0' , 'mac1' ] #NEWLINE# result = self . mgr . get_all_devices ( ) #NEWLINE# mock_ld . assert_called_once_with ( macvtap_neutron_agent . MACVTAP_FS ) #NEWLINE# self . assertEqual ( set ( [ 'mac0' , 'mac1' ] ) , result ) #NEWLINE# self . assertEqual ( { #NEWLINE# #INDENT# 'mac0' : 'macvtap0' , #NEWLINE# 'mac1' : 'macvtap1' , #NEWLINE# #UNINDENT# } , self . mgr . mac_device_name_mappings )