def periodic(self): db.session.remove() if self.hourly.check(): self.hourly.update() log.info("Running hourly tasks...") compute_collections() check_alerts() if self.daily.check(): self.daily.update() log.info("Running daily tasks...") generate_digest() update_roles()
def run_often(self): log.info("Self-check...") self.cleanup_jobs() compute_collections() if self.hourly.check(): self.hourly.update() log.info("Running hourly tasks...") check_alerts() if self.daily.check(): self.daily.update() log.info("Running daily tasks...") generate_digest() update_roles()
def periodic(self): with app.app_context(): db.session.remove() if self.often.check(): self.often.update() log.info("Self-check...") self.cleanup_jobs() compute_collections() if self.daily.check(): self.daily.update() log.info("Running daily tasks...") check_alerts() generate_digest() update_roles() delete_expired_exports()
def test_statistics(self): res = self.client.get("/api/2/statistics") assert res.status_code == 200, res assert "things" not in res.json, res.json self.load_fixtures() compute_collections() res = self.client.get("/api/2/statistics") assert res.status_code == 200, res assert res.json["collections"] == 1, res.json assert res.json["things"] == 1, res.json _, headers = self.login(is_admin=True) res = self.client.get("/api/2/statistics", headers=headers) assert res.status_code == 200, res assert res.json["collections"] == 1, res.json assert res.json["things"] == 1, res.json