#NEWLINE# def test_find_base_file_all( self ) : #NEWLINE# #INDENT# fingerprint = '968dd6cc49e01aaa044ed11c0cce733e0fa44a6a' #NEWLINE# listing = [ '00000001' , 'ephemeral_0_20_None' , '968dd6cc49e01aaa044ed11c0cce733e0fa44a6a_sm' , '968dd6cc49e01aaa044ed11c0cce733e0fa44a6a_10737418240' , '00000004' ] #NEWLINE# self . stub_out ( 'os.listdir' , ( lambda x : listing ) ) #NEWLINE# self . stub_out ( 'os.path.exists' , ( lambda x : True ) ) #NEWLINE# self . stub_out ( 'os.path.isfile' , ( lambda x : True ) ) #NEWLINE# base_dir = '/var/lib/nova/instances/_base' #NEWLINE# image_cache_manager = imagecache . ImageCacheManager ( ) #NEWLINE# image_cache_manager . _list_base_images ( base_dir ) #NEWLINE# res = list ( image_cache_manager . _find_base_file ( base_dir , listing ) ) #NEWLINE# base_file1 = os . path . join ( base_dir , fingerprint ) #NEWLINE# base_file2 = os . path . join ( base_dir , ( fingerprint + '_sm' ) ) #NEWLINE# base_file3 = os . path . join ( base_dir , ( fingerprint + '_10737418240' ) ) #NEWLINE# self . assertEqual ( res , [ ( base_file1 , False , False ) , ( base_file2 , True , False ) , ( base_file3 , False , True ) ] )