def test_publish_event(self): role = self.create_user() email = '*****@*****.**' label = 'So public' recipient = self.create_user(foreign_id='rolex', email=email) update_role(recipient) collection = self.create_collection(foreign_id='NoNoNo', label=label) event = Events.PUBLISH_COLLECTION publish(event, role.id, params={'collection': collection}, channels=[Notification.GLOBAL]) db.session.commit() notifications = Notification.all().all() assert 1 == len(notifications), notifications not0 = notifications[0] assert not0._event == event.name, not0._event assert not0.params['collection'] == str(collection.id), not0.params with mail.record_messages() as outbox: assert len(outbox) == 0, outbox generate_digest() assert len(outbox) == 1, outbox msg = outbox[0] assert email in msg.recipients, msg.recipients assert label in msg.html, msg.html
def periodic(self): db.session.remove() if self.hourly.check(): self.hourly.update() log.info("Running hourly tasks...") index_collections() if self.daily.check(): self.daily.update() log.info("Running daily tasks...") check_alerts() generate_digest()
def periodic(self): db.session.remove() if self.hourly.check(): self.hourly.update() log.info("Running hourly tasks...") self.cleanup_jobs() 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 daily(): generate_digest()
def daily(): check_alerts() generate_digest()
def daily_tasks(): log.info("Running daily tasks...") check_alerts() generate_digest()