#NEWLINE# @ mock . patch . object ( pathutils . PathUtils , 'get_base_vhd_dir' ) #NEWLINE# @ mock . patch . object ( pathutils . PathUtils , 'exists' ) #NEWLINE# def _test_lookup_image_basepath( self , mock_exists , mock_get_base_vhd_dir , found = True ) : #NEWLINE# #INDENT# fake_image_name = 'fake_image_name' #NEWLINE# if found : #NEWLINE# #INDENT# mock_exists . side_effect = [ False , True ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# mock_exists . return_value = False #NEWLINE# #UNINDENT# mock_get_base_vhd_dir . return_value = 'fake_base_dir' #NEWLINE# res = self . _pathutils . lookup_image_basepath ( fake_image_name ) #NEWLINE# mock_get_base_vhd_dir . assert_called_once_with ( ) #NEWLINE# if mock_exists : #NEWLINE# #INDENT# self . assertEqual ( res , os . path . join ( 'fake_base_dir' , 'fake_image_name.vhdx' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . assertIsNone ( res )