Esempio n. 1
0
	def test_fail_mtime_validity(self):
		self.filename = os.path.join(self.dir, 'empty')
		open(self.filename, 'w').close()

		self.assertIsNone(vignette.get_thumbnail(self.filename, 'large', use_fail_appname='foo'))
		assert vignette.is_thumbnail_failed(self.filename, 'foo')

		os.utime(self.filename, (0, 0))
		assert not vignette.is_thumbnail_failed(self.filename, 'foo')
Esempio n. 2
0
	def test_put_fail(self):
		vignette.put_fail(self.filename, 'foo')
		assert vignette.is_thumbnail_failed(self.filename, 'foo')
		assert not vignette.is_thumbnail_failed(self.filename, 'bar')

		self.assertIsNone(vignette.get_thumbnail(self.filename, use_fail_appname='foo'))
		dest = vignette.get_thumbnail(self.filename, use_fail_appname='bar')
		assert dest
		self.assertEqual(dest, vignette.get_thumbnail(self.filename, use_fail_appname='foo'))
Esempio n. 3
0
	def test_fail(self):
		self.filename = os.path.join(self.dir, 'empty')
		open(self.filename, 'w').close()

		self.assertIsNone(vignette.get_thumbnail(self.filename, 'large'))
		assert not os.path.exists(os.path.join(self.dir, 'thumbnails', 'fail'))
		assert not vignette.is_thumbnail_failed(self.filename, 'foo')

		self.assertIsNone(vignette.get_thumbnail(self.filename, 'large', use_fail_appname='foo'))
		assert os.path.exists(os.path.join(self.dir, 'thumbnails', 'fail', 'foo'))
		assert vignette.is_thumbnail_failed(self.filename, 'foo')
		assert not vignette.is_thumbnail_failed(self.filename, 'bar')