def test_basic(self): dest = vignette.build_thumbnail_path(self.filename, 'large') assert dest self.assertIsNone(vignette.try_get_thumbnail(self.filename, 'large')) assert not os.path.exists(dest) self.assertEqual(dest, vignette.get_thumbnail(self.filename, 'large')) assert os.path.isfile(dest) self.assertEqual(dest, vignette.try_get_thumbnail(self.filename, 'large'))
def test_hash(self): uri = u'file://%s' % self.filename dest = os.path.join(self.dir, 'thumbnails', 'large', hashlib.md5(uri.encode('utf-8')).hexdigest()) + '.png' self.assertEqual(dest, vignette.build_thumbnail_path(self.filename, 'large'))