From 2eba53f7639369ceb14db99143a7198eabb8fec8 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 22 May 2015 11:55:31 +0530 Subject: [PATCH] test case fixes --- erpnext/hr/doctype/salary_slip/test_salary_slip.py | 8 +++++++- erpnext/selling/doctype/customer/test_customer.py | 1 - erpnext/stock/doctype/item/test_item.py | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/erpnext/hr/doctype/salary_slip/test_salary_slip.py b/erpnext/hr/doctype/salary_slip/test_salary_slip.py index 9f7c5df238..2bb7f52f63 100644 --- a/erpnext/hr/doctype/salary_slip/test_salary_slip.py +++ b/erpnext/hr/doctype/salary_slip/test_salary_slip.py @@ -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') diff --git a/erpnext/selling/doctype/customer/test_customer.py b/erpnext/selling/doctype/customer/test_customer.py index 479c5b552c..1644f29ffc 100644 --- a/erpnext/selling/doctype/customer/test_customer.py +++ b/erpnext/selling/doctype/customer/test_customer.py @@ -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(): diff --git a/erpnext/stock/doctype/item/test_item.py b/erpnext/stock/doctype/item/test_item.py index a8f3583f98..33778c9799 100644 --- a/erpnext/stock/doctype/item/test_item.py +++ b/erpnext/stock/doctype/item/test_item.py @@ -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):