#NEWLINE# @ mock . patch . object ( vm_utils , '_snapshot_attached_here_impl' ) #NEWLINE# def test_snapshot_attached_here( self , mock_impl ) : #NEWLINE# #INDENT# def fake_impl( session , instance , vm_ref , label , userdevice , post_snapshot_callback ) : #NEWLINE# #INDENT# self . assertEqual ( 'session' , session ) #NEWLINE# self . assertEqual ( 'instance' , instance ) #NEWLINE# self . assertEqual ( 'vm_ref' , vm_ref ) #NEWLINE# self . assertEqual ( 'label' , label ) #NEWLINE# self . assertEqual ( '0' , userdevice ) #NEWLINE# self . assertIsNone ( post_snapshot_callback ) #NEWLINE# ( yield 'fake' ) #NEWLINE# #UNINDENT# mock_impl . side_effect = self #NEWLINE# with vm_utils . snapshot_attached_here ( 'session' , 'instance' , 'vm_ref' , 'label' ) as result : #NEWLINE# #INDENT# self . assertEqual ( 'fake' , result ) #NEWLINE# #UNINDENT# mock_impl . assert_called_once_with ( 'session' , 'instance' , 'vm_ref' , 'label' , '0' , None )