From 6e8eaf097aa43936e1cf31bf6f2ee2de41b75d6e Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 19 Feb 2016 00:27:02 +0530 Subject: [PATCH] [fix] test case of Leave Application --- .../hr/doctype/leave_application/test_leave_application.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/erpnext/hr/doctype/leave_application/test_leave_application.py b/erpnext/hr/doctype/leave_application/test_leave_application.py index 7580f39014..5b5910a2e2 100644 --- a/erpnext/hr/doctype/leave_application/test_leave_application.py +++ b/erpnext/hr/doctype/leave_application/test_leave_application.py @@ -214,6 +214,10 @@ class TestLeaveApplication(unittest.TestCase): frappe.set_user("test@example.com") application.status = "Approved" + + # clear permlevel access cache on change user + del application._has_access_to + self.assertRaises(LeaveDayBlockedError, application.submit) frappe.db.set_value("Leave Block List", "_Test Leave Block List", @@ -250,6 +254,7 @@ class TestLeaveApplication(unittest.TestCase): # submit leave application by Leave Approver frappe.set_user("test1@example.com") application.status = "Approved" + del application._has_access_to application.submit() self.assertEqual(frappe.db.get_value("Leave Application", application.name, "docstatus"), 1) @@ -289,6 +294,7 @@ class TestLeaveApplication(unittest.TestCase): application.leave_approver = "test2@example.com" application.insert() frappe.set_user("test1@example.com") + del application._has_access_to application.status = "Approved" from erpnext.hr.doctype.leave_application.leave_application import LeaveApproverIdentityError @@ -315,6 +321,7 @@ class TestLeaveApplication(unittest.TestCase): # change to valid leave approver and try to submit leave application frappe.set_user("test2@example.com") application.status = "Approved" + del application._has_access_to application.submit() self.assertEqual(frappe.db.get_value("Leave Application", application.name, "docstatus"), 1)