Skip to content

Commit

Permalink
test: set from date in manual leave allocation
Browse files Browse the repository at this point in the history
(cherry picked from commit f91172c)
  • Loading branch information
ruchamahabal authored and mergify[bot] committed Dec 18, 2024
1 parent 80d9c88 commit e83df51
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions hrms/hr/doctype/leave_allocation/test_earned_leaves.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,10 +495,23 @@ def test_allocate_leaves_manually(self):
get_leave_balance_on(self.employee.name, self.leave_type, frappe.flags.current_date), 6
)

leave_allocation.allocate_leaves_manually(6)
leave_allocation.allocate_leaves_manually(5)
self.assertEqual(
get_leave_balance_on(self.employee.name, self.leave_type, frappe.flags.current_date), 12
get_leave_balance_on(self.employee.name, self.leave_type, frappe.flags.current_date), 11
)

# manually set from_date - applicable from the next day
leave_allocation.allocate_leaves_manually(1, add_days(frappe.flags.current_date, 1))
# balance should be 11 on the current date
self.assertEqual(
get_leave_balance_on(self.employee.name, self.leave_type, frappe.flags.current_date), 11
)
# allocated leave should be applicable from the next day
self.assertEqual(
get_leave_balance_on(self.employee.name, self.leave_type, add_days(frappe.flags.current_date, 1)),
12,
)

self.assertRaises(frappe.ValidationError, leave_allocation.allocate_leaves_manually, 1)

def tearDown(self):
Expand Down

0 comments on commit e83df51

Please sign in to comment.