def test_cron_all_stale(self): old = time.time() - settings.WATERMARK_CLEANUP_SECONDS - 1000 for path in os.listdir(self.folder): os.utime(os.path.join(self.folder, path), (old, old)) cleanup_watermarked_file() assert not os.path.exists(self.folder)
def test_cron_one_stale(self): path = os.path.join(self.folder, os.listdir(self.folder)[0]) old = time.time() - settings.WATERMARK_CLEANUP_SECONDS - 1000 os.utime(path, (old, old)) cleanup_watermarked_file() eq_(len(os.listdir(self.folder)), UserProfile.objects.count() - 1)
def test_cron_fresh(self): cleanup_watermarked_file() eq_(len(os.listdir(self.folder)), UserProfile.objects.count())