Fixes in test cases
diff --git a/erpnext/hr/doctype/employee/employee.json b/erpnext/hr/doctype/employee/employee.json
index e80dabe..7606032 100644
--- a/erpnext/hr/doctype/employee/employee.json
+++ b/erpnext/hr/doctype/employee/employee.json
@@ -3,7 +3,7 @@
"allow_import": 1,
"allow_rename": 1,
"autoname": "naming_series:",
- "creation": "2013-03-07 09:04:18.000000",
+ "creation": "2013-03-07 09:04:18",
"docstatus": 0,
"doctype": "DocType",
"document_type": "Master",
@@ -722,7 +722,7 @@
],
"icon": "icon-user",
"idx": 1,
- "modified": "2014-02-03 18:06:04.000000",
+ "modified": "2014-04-30 09:01:10.879762",
"modified_by": "Administrator",
"module": "HR",
"name": "Employee",
@@ -771,6 +771,12 @@
"role": "HR Manager",
"submit": 0,
"write": 1
+ },
+ {
+ "permlevel": 0,
+ "read": 1,
+ "restricted": 1,
+ "role": "Leave Approver"
}
],
"search_fields": "employee_name"
diff --git a/erpnext/hr/doctype/leave_application/test_leave_application.py b/erpnext/hr/doctype/leave_application/test_leave_application.py
index 91fd583..fdd8bfe 100644
--- a/erpnext/hr/doctype/leave_application/test_leave_application.py
+++ b/erpnext/hr/doctype/leave_application/test_leave_application.py
@@ -118,7 +118,7 @@
from frappe.utils.user import add_role
add_role("test1@example.com", "Employee")
add_role("test@example.com", "Leave Approver")
- add_role("test@example.com", "HR Manager")
+ self._add_employee_leave_approver("_T-Employee-0002", "test@example.com")
application = self.get_application(_test_records[1])
application.leave_approver = "test@example.com"
diff --git a/erpnext/hr/doctype/salary_slip/test_salary_slip.py b/erpnext/hr/doctype/salary_slip/test_salary_slip.py
index 28a9f3f..e3f713c 100644
--- a/erpnext/hr/doctype/salary_slip/test_salary_slip.py
+++ b/erpnext/hr/doctype/salary_slip/test_salary_slip.py
@@ -8,7 +8,7 @@
def setUp(self):
frappe.db.sql("""delete from `tabLeave Application`""")
frappe.db.sql("""delete from `tabSalary Slip`""")
- from erpnext.hr.doctype.leave_application.test_leave_application import test_records as leave_applications
+ from erpnext.hr.doctype.leave_application.test_leave_application import _test_records as leave_applications
la = frappe.copy_doc(leave_applications[2])
la.insert()
la.status = "Approved"
diff --git a/erpnext/projects/doctype/time_log_batch/test_time_log_batch.py b/erpnext/projects/doctype/time_log_batch/test_time_log_batch.py
index fdbc210..a849ba7 100644
--- a/erpnext/projects/doctype/time_log_batch/test_time_log_batch.py
+++ b/erpnext/projects/doctype/time_log_batch/test_time_log_batch.py
@@ -4,6 +4,11 @@
import frappe, unittest
class TimeLogBatchTest(unittest.TestCase):
+ def setUp(self):
+ for name in frappe.db.sql_list("select name from `tabTime Log` where docstatus=1"):
+ frappe.get_doc("Time Log", name).cancel()
+ frappe.delete_doc("Time Log", name)
+
def test_time_log_status(self):
from erpnext.projects.doctype.time_log.test_time_log import test_records as time_log_records
time_log = frappe.copy_doc(time_log_records[0])
diff --git a/erpnext/selling/doctype/lead/test_lead.py b/erpnext/selling/doctype/lead/test_lead.py
index 606e328..218e75a 100644
--- a/erpnext/selling/doctype/lead/test_lead.py
+++ b/erpnext/selling/doctype/lead/test_lead.py
@@ -12,6 +12,8 @@
def test_make_customer(self):
from erpnext.selling.doctype.lead.lead import make_customer
+ frappe.delete_doc_if_exists("Customer", "_Test Lead")
+
customer = make_customer("_T-Lead-00001")
self.assertEquals(customer.doctype, "Customer")
self.assertEquals(customer.lead_name, "_T-Lead-00001")
diff --git a/erpnext/stock/doctype/serial_no/test_serial_no.py b/erpnext/stock/doctype/serial_no/test_serial_no.py
index 9518e78..dc0a4c7 100644
--- a/erpnext/stock/doctype/serial_no/test_serial_no.py
+++ b/erpnext/stock/doctype/serial_no/test_serial_no.py
@@ -14,16 +14,18 @@
class TestSerialNo(unittest.TestCase):
def test_cannot_create_direct(self):
+ frappe.delete_doc_if_exists("Serial No", "_TCSER0001")
+
sr = frappe.new_doc("Serial No")
sr.item_code = "_Test Serialized Item"
sr.warehouse = "_Test Warehouse - _TC"
sr.serial_no = "_TCSER0001"
sr.purchase_rate = 10
self.assertRaises(SerialNoCannotCreateDirectError, sr.insert)
-
+
sr.warehouse = None
sr.insert()
self.assertTrue(sr.name)
sr.warehouse = "_Test Warehouse - _TC"
- self.assertTrue(SerialNoCannotCannotChangeError, sr.save)
\ No newline at end of file
+ self.assertTrue(SerialNoCannotCannotChangeError, sr.save)