#NEWLINE# def _test_plug( self , namespace = None , mtu = None ) : #NEWLINE# #INDENT# def device_exists( device , namespace = None ) : #NEWLINE# #INDENT# return device . startswith ( 'brq' ) #NEWLINE# #UNINDENT# root_veth = mock . Mock ( ) #NEWLINE# ns_veth = mock . Mock ( ) #NEWLINE# self . ip ( ) . add_veth = mock . Mock ( return_value = ( root_veth , ns_veth ) ) #NEWLINE# self . device_exists . side_effect = device_exists #NEWLINE# br = interface . BridgeInterfaceDriver ( self . conf ) #NEWLINE# mac_address = 'aa:bb:cc:dd:ee:ff' #NEWLINE# br . plug ( '01234567-1234-1234-99' , 'port-1234' , 'ns-0' , mac_address , namespace = namespace ) #NEWLINE# ip_calls = [ mock . call ( ) , mock . call ( ) . add_veth ( 'tap0' , 'ns-0' , namespace2 = namespace ) ] #NEWLINE# ns_veth . assert_has_calls ( [ mock . call . link . set_address ( mac_address ) ] ) #NEWLINE# if mtu : #NEWLINE# #INDENT# ns_veth . assert_has_calls ( [ mock . call . link . set_mtu ( ip_calls ) ] ) #NEWLINE# root_veth . assert_has_calls ( [ mock . call . link . set_mtu ( mtu ) ] ) #NEWLINE# #UNINDENT# self . ip . assert_has_calls ( ip_calls ) #NEWLINE# root_veth . assert_has_calls ( [ mock . call . link . set_up ( ) ] ) #NEWLINE# ns_veth . assert_has_calls ( [ mock . call . link . set_up ( ) ] )