test: fix test test_leave_balance_near_allocaton_expiry

This commit is contained in:
Rucha Mahabal 2022-02-28 15:27:24 +05:30
parent aaa1ae94f2
commit a58dfecb23
2 changed files with 4 additions and 5 deletions

View File

@ -660,10 +660,7 @@ def get_remaining_leaves(allocation, leaves_taken, date, cf_expiry) -> Dict[str,
leave_balance_for_consumption = flt(allocation.new_leaves_allocated) + flt(remaining_cf_leaves)
remaining_leaves = _get_remaining_leaves(leave_balance_for_consumption, allocation.to_date)
return {
'leave_balance': leave_balance,
'leave_balance_for_consumption': remaining_leaves
}
return frappe._dict(leave_balance=leave_balance, leave_balance_for_consumption=remaining_leaves)
def get_leaves_for_period(employee, leave_type, from_date, to_date, skip_expired_leaves=True):
leave_entries = get_leave_entries(employee, leave_type, from_date, to_date)

View File

@ -506,8 +506,10 @@ class TestLeaveApplication(unittest.TestCase):
leave_type.insert()
create_carry_forwarded_allocation(employee, leave_type)
details = get_leave_balance_on(employee.name, leave_type.name, nowdate(), add_days(nowdate(), 8), for_consumption=True)
self.assertEqual(get_leave_balance_on(employee.name, leave_type.name, nowdate(), add_days(nowdate(), 8)), 21)
self.assertEqual(details.leave_balance_for_consumption, 21)
self.assertEqual(details.leave_balance, 30)
def test_earned_leaves_creation(self):