Fixes in test cases

This commit is contained in:
Anand Doshi 2014-04-30 22:16:25 +05:30
parent a15164750d
commit d9f0f27cd4
6 changed files with 21 additions and 6 deletions

View File

@ -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"

View File

@ -118,7 +118,7 @@ class TestLeaveApplication(unittest.TestCase):
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"

View File

@ -8,7 +8,7 @@ class TestSalarySlip(unittest.TestCase):
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"

View File

@ -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])

View File

@ -12,6 +12,8 @@ class TestLead(unittest.TestCase):
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")

View File

@ -14,16 +14,18 @@ from erpnext.stock.doctype.serial_no.serial_no import *
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)
self.assertTrue(SerialNoCannotCannotChangeError, sr.save)