mirror of
https://github.com/Hopiu/django-imagekit.git
synced 2026-03-17 05:40:25 +00:00
Test stringification of LazyImageCacheFiles
This commit is contained in:
parent
654867c3cf
commit
3001069254
1 changed files with 15 additions and 2 deletions
|
|
@ -1,11 +1,12 @@
|
|||
from django.conf import settings
|
||||
from hashlib import md5
|
||||
from imagekit.cachefiles import ImageCacheFile
|
||||
from imagekit.cachefiles import ImageCacheFile, LazyImageCacheFile
|
||||
from imagekit.cachefiles.backends import Simple
|
||||
from nose.tools import raises, eq_
|
||||
from .imagegenerators import TestSpec
|
||||
from .utils import (assert_file_is_truthy, assert_file_is_falsy,
|
||||
DummyAsyncCacheFileBackend, get_unique_image_file)
|
||||
DummyAsyncCacheFileBackend, get_unique_image_file,
|
||||
get_image_file)
|
||||
|
||||
|
||||
def test_no_source_falsiness():
|
||||
|
|
@ -73,3 +74,15 @@ def test_memcached_cache_key():
|
|||
settings.IMAGEKIT_CACHE_PREFIX,
|
||||
'1' * (200 - len(':') - 32 - len(settings.IMAGEKIT_CACHE_PREFIX)),
|
||||
md5('%s%s-state' % (settings.IMAGEKIT_CACHE_PREFIX, filename)).hexdigest()))
|
||||
|
||||
|
||||
def test_lazyfile_stringification():
|
||||
file = LazyImageCacheFile('testspec', source=None)
|
||||
eq_(str(file), '')
|
||||
eq_(repr(file), '<ImageCacheFile: None>')
|
||||
|
||||
source_file = get_image_file()
|
||||
file = LazyImageCacheFile('testspec', source=source_file)
|
||||
file.name = 'a.jpg'
|
||||
eq_(str(file), 'a.jpg')
|
||||
eq_(repr(file), '<ImageCacheFile: a.jpg>')
|
||||
|
|
|
|||
Loading…
Reference in a new issue