Edited the Test case

This commit is contained in:
Meatechsupport 2015-07-28 18:39:04 +04:00
parent 8b96fdac12
commit 145227e4ec

View File

@ -19,7 +19,8 @@ _test_records = [
"from_date": "2013-05-01",
"leave_type": "_Test Leave Type",
"posting_date": "2013-01-02",
"to_date": "2013-05-05"
"to_date": "2013-05-05",
"get_holidays": "2013-05-03"
},
{
"company": "_Test Company",
@ -29,7 +30,8 @@ _test_records = [
"from_date": "2013-05-01",
"leave_type": "_Test Leave Type",
"posting_date": "2013-01-02",
"to_date": "2013-05-05"
"to_date": "2013-05-05",
"get_holidays": "2013-05-03"
},
{
"company": "_Test Company",
@ -39,7 +41,8 @@ _test_records = [
"from_date": "2013-01-15",
"leave_type": "_Test Leave Type LWP",
"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):
frappe.db.set_value("Leave Type", self.leave_type, "include_holiday", 0)
application = frappe.copy_doc(_test_records[2])
application.from_date = "2015-07-01"
application.to_date = "2015-07-05"
application.get_holidays = "2015-07-03"
application = frappe.copy_doc(_test_records[0])
application.insert()
self.assertEquals(application.tot_days, 5)
self.assertEquals(application.holidays, 1)
self.assertEquals(application.ret, 4)
def test_include_holiday_in_leave(self):
frappe.db.set_value("Leave Type", self.leave_type, "include_holiday", 1)
application = frappe.copy_doc(_test_records[2])
application.from_date = "2015-07-01"
application.to_date = "2015-07-05"
application.get_holidays = "2015-07-03"
application = frappe.copy_doc(_test_records[0])
application.insert()
self.assertEquals(application.tot_days, 5)
self.assertEquals(application.holidays, 1)
self.assertEquals(application.ret, 5)
def tearDown(self):
frappe.db.set_value("Leave Type", self.leave_type, "include_holiday", 0)
self.assertEquals(application.ret, 5)