def test_restrict_scheduler_events(self): frappe.set_user("Administrator") dormant_date = add_days(today(), -5) frappe.db.sql('update tabUser set last_active=%s', dormant_date) restrict_scheduler_events_if_dormant() frappe.local.conf = _dict(frappe.get_site_config()) self.assertFalse("all" in get_enabled_scheduler_events()) self.assertTrue(frappe.conf.get('dormant', False)) clear_limit("expiry") frappe.local.conf = _dict(frappe.get_site_config())
def test_restrict_scheduler_events(self): frappe.set_user("Administrator") user = frappe.get_doc("User", "Administrator") dormant_date = add_days(today(), -5) user.last_active = dormant_date user.save() restrict_scheduler_events_if_dormant() frappe.local.conf = _dict(frappe.get_site_config()) self.assertFalse("all" in get_enabled_scheduler_events()) self.assertTrue(frappe.conf.get('dormant', False)) clear_limit("expiry") frappe.local.conf = _dict(frappe.get_site_config())