<s> """<STR_LIT>""" <EOL> from easy_thumbnails import utils <EOL> from easy_thumbnails . models import Thumbnail , Source <EOL> from easy_thumbnails . tests import utils as test <EOL> class FileManagerTest ( test . BaseTest ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> super ( FileManagerTest , self ) . setUp ( ) <EOL> self . storage = test . TemporaryStorage ( ) <EOL> self . storage_hash = utils . get_storage_hash ( self . storage ) <EOL> self . source = Source . objects . create ( <EOL> name = '<STR_LIT>' , <EOL> storage_hash = self . storage_hash ) <EOL> self . filename = self . create_image ( self . storage , '<STR_LIT>' ) <EOL> def tearDown ( self ) : <EOL> self . storage . delete_temporary_storage ( ) <EOL> super ( FileManagerTest , self ) . tearDown ( ) <EOL> def test_create_file ( self ) : <EOL> """<STR_LIT>""" <EOL> img = Thumbnail . objects . get_file ( <EOL> self . storage , <EOL> self . filename , <EOL> create = True , <EOL> source = self . source ) <EOL> self . assertEqual ( img . name , self . filename ) <EOL> def test_get_file ( self ) : <EOL> """<STR_LIT>""" <EOL> created = Thumbnail . objects . create ( <EOL> storage_hash = self . storage_hash , <EOL> name = self . filename , <EOL> source = self . source ) <EOL> fetched = Thumbnail . objects . get_file ( <EOL> self . storage , <EOL> self . filename , <EOL> create = False ) <EOL> self . assertTrue ( fetched ) <EOL> self . assertEqual ( created , fetched ) <EOL> def test_get_file_check_cache ( self ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> Thumbnail . objects . get ( name = self . filename ) <EOL> self . fail ( '<STR_LIT>' ) <EOL> except Thumbnail . DoesNotExist : <EOL> pass <EOL> Thumbnail . objects . get_file ( <EOL> self . storage , <EOL> self . filename , <EOL> source = self . source , <EOL> check_cache_miss = True ) <EOL> try : <EOL> Thumbnail . objects . get ( name = self . filename ) <EOL> except Thumbnail . DoesNotExist : <EOL> self . fail ( '<STR_LIT>' ) </s>
