def test_cleanup2(self): file = tempfile.NamedTemporaryFile(mode='w+t', encoding='utf-8', delete=False) file.write(self.UNITTEST) file.close() provider = uuid.uuid4().hex self.ci.section = provider self.ci.path = file.name self.ci.url = URL2 self.s.add(RefreshLog(self.ci, DIGEST_DUMMY)) self.s.commit() self.assertEqual(1, RefreshLog.cleanup_provider(provider))
def cleanup_providers() -> int: count = 0 for section in config.sections(): if config.auto_cleanup(section) and not config.is_enabled(section): count += RefreshLog.cleanup_provider(section) return count
def test_cleanup1(self): self.assertEqual(0, RefreshLog.cleanup_provider(self.UNKNOWN))