mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-08 15:42:52 +00:00
fix: test added to check work from home application
This commit is contained in:
@@ -13,7 +13,28 @@ class TestAttendanceRequest(unittest.TestCase):
|
|||||||
for doctype in ["Attendance Request", "Attendance"]:
|
for doctype in ["Attendance Request", "Attendance"]:
|
||||||
frappe.db.sql("delete from `tab{doctype}`".format(doctype=doctype))
|
frappe.db.sql("delete from `tab{doctype}`".format(doctype=doctype))
|
||||||
|
|
||||||
def test_attendance_request(self):
|
def test_on_duty_attendance_request(self):
|
||||||
|
today = nowdate()
|
||||||
|
employee = get_employee()
|
||||||
|
attendance_request = frappe.new_doc("Attendance Request")
|
||||||
|
attendance_request.employee = employee.name
|
||||||
|
attendance_request.from_date = date(date.today().year, 1, 1)
|
||||||
|
attendance_request.to_date = date(date.today().year, 1, 2)
|
||||||
|
attendance_request.reason = "On Duty"
|
||||||
|
attendance_request.company = "_Test Company"
|
||||||
|
attendance_request.insert()
|
||||||
|
attendance_request.submit()
|
||||||
|
attendance = frappe.get_doc('Attendance', {
|
||||||
|
'employee': employee.name,
|
||||||
|
'attendance_date': date(date.today().year, 1, 1),
|
||||||
|
'docstatus': 1
|
||||||
|
})
|
||||||
|
self.assertEqual(attendance.status, 'Present')
|
||||||
|
attendance_request.cancel()
|
||||||
|
attendance.reload()
|
||||||
|
self.assertEqual(attendance.docstatus, 2)
|
||||||
|
|
||||||
|
def test_work_from_home_attendance_request(self):
|
||||||
today = nowdate()
|
today = nowdate()
|
||||||
employee = get_employee()
|
employee = get_employee()
|
||||||
attendance_request = frappe.new_doc("Attendance Request")
|
attendance_request = frappe.new_doc("Attendance Request")
|
||||||
@@ -29,7 +50,7 @@ class TestAttendanceRequest(unittest.TestCase):
|
|||||||
'attendance_date': date(date.today().year, 1, 1),
|
'attendance_date': date(date.today().year, 1, 1),
|
||||||
'docstatus': 1
|
'docstatus': 1
|
||||||
})
|
})
|
||||||
self.assertEqual(attendance.status, 'Present')
|
self.assertEqual(attendance.status, 'Work From Home')
|
||||||
attendance_request.cancel()
|
attendance_request.cancel()
|
||||||
attendance.reload()
|
attendance.reload()
|
||||||
self.assertEqual(attendance.docstatus, 2)
|
self.assertEqual(attendance.docstatus, 2)
|
||||||
|
|||||||
Reference in New Issue
Block a user