def test_autodiscover(self): thumbnail.autodiscover() image = FakeImage(image=RELATIVE_PIC_NAME, misc=1) image.save() thumb = Thumbnail(image.image, 20, 15) self.verify_thumb(thumb, 20, 15, '20x15_q85.jpg') cache = os.path.join( settings.CUDDLYBUDDLY_THUMBNAIL_CACHE, md5_constructor(force_unicode(image.image)).hexdigest() ) self.assert_(os.path.exists(cache), 'Does not exist: %s' % cache) self.cache_to_delete.add(cache) image.misc = 1 image.save() self.assert_(not os.path.exists(cache), 'Should not exist: %s' % cache) thumb = Thumbnail(image.image, 20, 15) self.verify_thumb(thumb, 20, 15, '20x15_q85.jpg') self.assert_(os.path.exists(cache), 'Does not exist: %s' % cache) image.delete() self.assert_(not os.path.exists(cache), 'Should not exist: %s' % cache)
from django.conf.urls.defaults import * from django.contrib import admin from cuddlybuddly import thumbnail admin.autodiscover() thumbnail.autodiscover() urlpatterns = patterns('', (r'^admin/doc/', include('django.contrib.admindocs.urls')), )