Edited the Test case
This commit is contained in:
parent
8b96fdac12
commit
145227e4ec
@ -19,7 +19,8 @@ _test_records = [
|
|||||||
"from_date": "2013-05-01",
|
"from_date": "2013-05-01",
|
||||||
"leave_type": "_Test Leave Type",
|
"leave_type": "_Test Leave Type",
|
||||||
"posting_date": "2013-01-02",
|
"posting_date": "2013-01-02",
|
||||||
"to_date": "2013-05-05"
|
"to_date": "2013-05-05",
|
||||||
|
"get_holidays": "2013-05-03"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"company": "_Test Company",
|
"company": "_Test Company",
|
||||||
@ -29,7 +30,8 @@ _test_records = [
|
|||||||
"from_date": "2013-05-01",
|
"from_date": "2013-05-01",
|
||||||
"leave_type": "_Test Leave Type",
|
"leave_type": "_Test Leave Type",
|
||||||
"posting_date": "2013-01-02",
|
"posting_date": "2013-01-02",
|
||||||
"to_date": "2013-05-05"
|
"to_date": "2013-05-05",
|
||||||
|
"get_holidays": "2013-05-03"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"company": "_Test Company",
|
"company": "_Test Company",
|
||||||
@ -39,7 +41,8 @@ _test_records = [
|
|||||||
"from_date": "2013-01-15",
|
"from_date": "2013-01-15",
|
||||||
"leave_type": "_Test Leave Type LWP",
|
"leave_type": "_Test Leave Type LWP",
|
||||||
"posting_date": "2013-01-02",
|
"posting_date": "2013-01-02",
|
||||||
"to_date": "2013-01-15"
|
"to_date": "2013-01-15",
|
||||||
|
"get_holidays": "2013-05-03"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -250,27 +253,18 @@ class TestLeaveApplication(unittest.TestCase):
|
|||||||
|
|
||||||
def test_exclude_holiday_in_leave(self):
|
def test_exclude_holiday_in_leave(self):
|
||||||
frappe.db.set_value("Leave Type", self.leave_type, "include_holiday", 0)
|
frappe.db.set_value("Leave Type", self.leave_type, "include_holiday", 0)
|
||||||
application = frappe.copy_doc(_test_records[2])
|
application = frappe.copy_doc(_test_records[0])
|
||||||
application.from_date = "2015-07-01"
|
|
||||||
application.to_date = "2015-07-05"
|
|
||||||
application.get_holidays = "2015-07-03"
|
|
||||||
application.insert()
|
application.insert()
|
||||||
|
|
||||||
self.assertEquals(application.tot_days, 5)
|
self.assertEquals(application.tot_days, 5)
|
||||||
self.assertEquals(application.holidays, 1)
|
self.assertEquals(application.holidays, 1)
|
||||||
self.assertEquals(application.ret, 4)
|
self.assertEquals(application.ret, 4)
|
||||||
|
|
||||||
def test_include_holiday_in_leave(self):
|
def test_include_holiday_in_leave(self):
|
||||||
frappe.db.set_value("Leave Type", self.leave_type, "include_holiday", 1)
|
frappe.db.set_value("Leave Type", self.leave_type, "include_holiday", 1)
|
||||||
application = frappe.copy_doc(_test_records[2])
|
application = frappe.copy_doc(_test_records[0])
|
||||||
application.from_date = "2015-07-01"
|
|
||||||
application.to_date = "2015-07-05"
|
|
||||||
application.get_holidays = "2015-07-03"
|
|
||||||
application.insert()
|
application.insert()
|
||||||
|
|
||||||
self.assertEquals(application.tot_days, 5)
|
self.assertEquals(application.tot_days, 5)
|
||||||
self.assertEquals(application.holidays, 1)
|
self.assertEquals(application.holidays, 1)
|
||||||
self.assertEquals(application.ret, 5)
|
self.assertEquals(application.ret, 5)
|
||||||
|
|
||||||
def tearDown(self):
|
|
||||||
frappe.db.set_value("Leave Type", self.leave_type, "include_holiday", 0)
|
|
Loading…
Reference in New Issue
Block a user