[fix] test case of Leave Application
This commit is contained in:
parent
6dc83b356a
commit
6e8eaf097a
@ -214,6 +214,10 @@ class TestLeaveApplication(unittest.TestCase):
|
|||||||
|
|
||||||
frappe.set_user("test@example.com")
|
frappe.set_user("test@example.com")
|
||||||
application.status = "Approved"
|
application.status = "Approved"
|
||||||
|
|
||||||
|
# clear permlevel access cache on change user
|
||||||
|
del application._has_access_to
|
||||||
|
|
||||||
self.assertRaises(LeaveDayBlockedError, application.submit)
|
self.assertRaises(LeaveDayBlockedError, application.submit)
|
||||||
|
|
||||||
frappe.db.set_value("Leave Block List", "_Test Leave Block List",
|
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
|
# submit leave application by Leave Approver
|
||||||
frappe.set_user("test1@example.com")
|
frappe.set_user("test1@example.com")
|
||||||
application.status = "Approved"
|
application.status = "Approved"
|
||||||
|
del application._has_access_to
|
||||||
application.submit()
|
application.submit()
|
||||||
self.assertEqual(frappe.db.get_value("Leave Application", application.name,
|
self.assertEqual(frappe.db.get_value("Leave Application", application.name,
|
||||||
"docstatus"), 1)
|
"docstatus"), 1)
|
||||||
@ -289,6 +294,7 @@ class TestLeaveApplication(unittest.TestCase):
|
|||||||
application.leave_approver = "test2@example.com"
|
application.leave_approver = "test2@example.com"
|
||||||
application.insert()
|
application.insert()
|
||||||
frappe.set_user("test1@example.com")
|
frappe.set_user("test1@example.com")
|
||||||
|
del application._has_access_to
|
||||||
application.status = "Approved"
|
application.status = "Approved"
|
||||||
|
|
||||||
from erpnext.hr.doctype.leave_application.leave_application import LeaveApproverIdentityError
|
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
|
# change to valid leave approver and try to submit leave application
|
||||||
frappe.set_user("test2@example.com")
|
frappe.set_user("test2@example.com")
|
||||||
application.status = "Approved"
|
application.status = "Approved"
|
||||||
|
del application._has_access_to
|
||||||
application.submit()
|
application.submit()
|
||||||
self.assertEqual(frappe.db.get_value("Leave Application", application.name,
|
self.assertEqual(frappe.db.get_value("Leave Application", application.name,
|
||||||
"docstatus"), 1)
|
"docstatus"), 1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user