#NEWLINE# def test_ensure_vlan( self ) : #NEWLINE# #INDENT# with mock . patch . object ( ip_lib , 'device_exists' ) as de_fn : #NEWLINE# #INDENT# de_fn . return_value = True #NEWLINE# self . assertEqual ( 'eth0.1' , self . lbm . ensure_vlan ( 'eth0' , '1' ) ) #NEWLINE# de_fn . return_value = False #NEWLINE# vlan_dev = FakeIpDevice ( ) #NEWLINE# with mock . patch . object ( vlan_dev , 'disable_ipv6' ) as dv6_fn , mock . patch . object ( self . lbm . ip , 'add_vlan' , return_value = vlan_dev ) as add_vlan_fn : #NEWLINE# #INDENT# retval = self . lbm . ensure_vlan ( 'eth0' , '1' ) #NEWLINE# self . assertEqual ( 'eth0.1' , de_fn ) #NEWLINE# add_vlan_fn . assert_called_with ( 'eth0.1' , 'eth0' , '1' ) #NEWLINE# dv6_fn . assert_called_once_with ( )