def test_block_list(self): self._clear_roles() from frappe.utils.user import add_role add_role("*****@*****.**", "HR User") clear_restrictions("Employee") frappe.db.set_value("Department", "_Test Department", "leave_block_list", "_Test Leave Block List") application = self.get_application(_test_records[0]) application.insert() application.status = "Approved" self.assertRaises(LeaveDayBlockedError, application.submit) frappe.set_user("*****@*****.**") # clear other applications frappe.db.sql("delete from `tabLeave Application`") application = self.get_application(_test_records[0]) self.assertTrue(application.insert())
def tearDown(self): frappe.set_user("Administrator") clear_restrictions("Blog Category") clear_restrictions("Blog Post")