test case fixes

This commit is contained in:
Nabin Hait 2015-05-22 11:55:31 +05:30
parent 866e9047b0
commit 2eba53f763
3 changed files with 9 additions and 2 deletions

View File

@ -12,6 +12,9 @@ class TestSalarySlip(unittest.TestCase):
def setUp(self):
frappe.db.sql("""delete from `tabLeave Application`""")
frappe.db.sql("""delete from `tabSalary Slip`""")
frappe.db.set_value("Holiday List", "_Test Holiday List", "is_default", 1)
from erpnext.hr.doctype.leave_application.test_leave_application import _test_records as leave_applications
la = frappe.copy_doc(leave_applications[2])
la.insert()
@ -26,6 +29,7 @@ class TestSalarySlip(unittest.TestCase):
frappe.db.set_value("HR Settings", "HR Settings", "include_holidays_in_total_working_days", 1)
ss = frappe.copy_doc(test_records[0])
ss.insert()
self.assertEquals(ss.total_days_in_month, 31)
self.assertEquals(ss.payment_days, 30)
self.assertEquals(ss.earnings[0].e_modified_amount, 14516.13)
@ -36,8 +40,10 @@ class TestSalarySlip(unittest.TestCase):
self.assertEquals(ss.net_pay, 14867.74)
def test_salary_slip_with_holidays_excluded(self):
frappe.db.set_value("HR Settings", "HR Settings", "include_holidays_in_total_working_days", 0)
ss = frappe.copy_doc(test_records[0])
ss.insert()
self.assertEquals(ss.total_days_in_month, 30)
self.assertEquals(ss.payment_days, 29)
self.assertEquals(ss.earnings[0].e_modified_amount, 14500)
@ -102,6 +108,6 @@ class TestSalarySlip(unittest.TestCase):
return salary_slip
test_dependencies = ["Leave Application"]
test_dependencies = ["Leave Application", "Holiday List"]
test_records = frappe.get_test_records('Salary Slip')

View File

@ -34,7 +34,6 @@ class TestCustomer(unittest.TestCase):
make_test_records("Address")
make_test_records("Contact")
details = get_party_details("_Test Customer")
for key, value in to_check.iteritems():

View File

@ -34,6 +34,8 @@ class TestItem(unittest.TestCase):
se = make_stock_entry(item_code=item.name, target="Stores - _TC", qty=1, incoming_rate=1)
item.has_variants = 1
item.append("variants", {"item_attribute": "Test Size", "item_attribute_value": "Small"})
self.assertRaises(ItemTemplateCannotHaveStock, item.save)
def test_variant_item_codes(self):