#NEWLINE# def test_list_backing_images_instancename( self ) : #NEWLINE# #INDENT# self . stub_out ( 'os.listdir' , ( lambda x : [ '_base' , 'banana-42-hamster' ] ) ) #NEWLINE# self . stub_out ( 'os.path.exists' , ( lambda x : ( x . find ( 'banana-42-hamster' ) != ( - 1 ) ) ) ) #NEWLINE# self . stubs . Set ( libvirt_utils , 'get_disk_backing_file' , ( lambda x : 'e97222e91fc4241f49a7f520d1dcf446751129b3_sm' ) ) #NEWLINE# found = os . path . join ( CONF . instances_path , CONF . image_cache_subdirectory_name , 'e97222e91fc4241f49a7f520d1dcf446751129b3_sm' ) #NEWLINE# image_cache_manager = imagecache . ImageCacheManager ( ) #NEWLINE# image_cache_manager . unexplained_images = [ found ] #NEWLINE# image_cache_manager . instance_names = self . stock_instance_names #NEWLINE# inuse_images = image_cache_manager . _list_backing_images ( ) #NEWLINE# self . assertEqual ( inuse_images , [ found ] ) #NEWLINE# self . assertEqual ( len ( inuse_images . unexplained_images ) , 0 )