upgraded test_runner, now can run multiple tests

This commit is contained in:
Rushabh Mehta
2013-02-12 19:20:39 +05:30
parent 9a8319dd0b
commit 4b9827a5fc
75 changed files with 508 additions and 662 deletions

View File

@@ -21,4 +21,3 @@ class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
test_records = [[{"doctype":"Branch", "branch":"_Test Branch"}]]

View File

@@ -0,0 +1 @@
test_records = [[{"doctype":"Branch", "branch":"_Test Branch"}]]

View File

@@ -20,9 +20,4 @@ import webnotes
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
test_records = [
[{"doctype":"Department", "department_name":"_Test Department"}],
[{"doctype":"Department", "department_name":"_Test Department with Block List",
"holiday_block_list": "_Test Holiday Block List"}],
]

View File

@@ -0,0 +1,5 @@
test_records = [
[{"doctype":"Department", "department_name":"_Test Department"}],
[{"doctype":"Department", "department_name":"_Test Department with Block List",
"holiday_block_list": "_Test Holiday Block List"}],
]

View File

@@ -21,4 +21,3 @@ class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
test_records = [[{"doctype":"Designation", "designation_name":"_Test Designation"}]]

View File

@@ -0,0 +1 @@
test_records = [[{"doctype":"Designation", "designation_name":"_Test Designation"}]]

View File

@@ -128,26 +128,3 @@ class DocType:
if self.doc.status == 'Left' and not self.doc.relieving_date:
msgprint("Please enter relieving date.")
raise Exception
test_records = [[{
"doctype":"Employee",
"employee_name": "_Test Employee",
"naming_series": "_T-Employee-",
"date_of_joining": "2010-01-01",
"date_of_birth": "1980-01-01",
"gender": "Female",
"status": "Active",
"company": "_Test Company",
"user_id": "test@erpnext.com"
}],
[{
"doctype":"Employee",
"employee_name": "_Test Employee 1",
"naming_series": "_T-Employee-",
"date_of_joining": "2010-01-01",
"date_of_birth": "1980-01-01",
"gender": "Male",
"status": "Active",
"company": "_Test Company",
"user_id": "test1@erpnext.com"
}]]

View File

@@ -0,0 +1,22 @@
test_records = [[{
"doctype":"Employee",
"employee_name": "_Test Employee",
"naming_series": "_T-Employee-",
"date_of_joining": "2010-01-01",
"date_of_birth": "1980-01-01",
"gender": "Female",
"status": "Active",
"company": "_Test Company",
"user_id": "test@erpnext.com"
}],
[{
"doctype":"Employee",
"employee_name": "_Test Employee 1",
"naming_series": "_T-Employee-",
"date_of_joining": "2010-01-01",
"date_of_birth": "1980-01-01",
"gender": "Male",
"status": "Active",
"company": "_Test Company",
"user_id": "test1@erpnext.com"
}]]

View File

@@ -20,6 +20,4 @@ import webnotes
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
test_records = [[{"doctype":"Employment Type",
"employee_type_name": "_Test Employment Type"}]]

View File

@@ -0,0 +1,2 @@
test_records = [[{"doctype":"Employment Type",
"employee_type_name": "_Test Employment Type"}]]

View File

@@ -21,4 +21,3 @@ class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
test_records = [[{"doctype":"Grade", "grade_name":"Test Grade"}]]

View File

@@ -0,0 +1 @@
test_records = [[{"doctype":"Grade", "grade_name":"_Test Grade"}]]

View File

@@ -20,23 +20,3 @@ class DocType:
webnotes.msgprint(_("Date is repeated") + ":" + d.block_date, raise_exception=1)
dates.append(d.block_date)
test_records = [[{
"doctype":"Holiday Block List",
"holiday_block_list_name": "_Test Holiday Block List",
"year": "_Test Fiscal Year 2013",
"company": "_Test Company"
}, {
"doctype": "Holiday Block List Date",
"parent": "_Test Holiday Block List",
"parenttype": "Holiday Block List",
"parentfield": "holiday_block_list_dates",
"block_date": "2013-01-02",
"reason": "First work day"
}, {
"doctype": "Holiday Block List Allow",
"parent": "_Test Holiday Block List",
"parenttype": "Holiday Block List",
"parentfield": "holiday_block_list_allowed",
"allow_user": "test1@erpnext.com",
}
]]

View File

@@ -0,0 +1,20 @@
test_records = [[{
"doctype":"Holiday Block List",
"holiday_block_list_name": "_Test Holiday Block List",
"year": "_Test Fiscal Year 2013",
"company": "_Test Company"
}, {
"doctype": "Holiday Block List Date",
"parent": "_Test Holiday Block List",
"parenttype": "Holiday Block List",
"parentfield": "holiday_block_list_dates",
"block_date": "2013-01-02",
"reason": "First work day"
}, {
"doctype": "Holiday Block List Allow",
"parent": "_Test Holiday Block List",
"parenttype": "Holiday Block List",
"parentfield": "holiday_block_list_allowed",
"allow_user": "test1@erpnext.com",
}
]]

View File

@@ -89,16 +89,3 @@ class DocType:
def update_default_holiday_list(self):
webnotes.conn.sql("""update `tabHoliday List` set is_default = 0
where ifnull(is_default, 0) = 1 and fiscal_year = %s""", (self.doc.fiscal_year,))
test_records = [[{
"doctype": "Holiday List",
"holiday_list_name": "_Test Holiday List",
"fiscal_year": "_Test Fiscal Year 2013"
}, {
"doctype": "Holiday",
"parent": "_Test Holiday List",
"parenttype": "Holiday List",
"parentfield": "holiday_list_details",
"holiday_date": "2013-01-01",
"description": "New Year"
}]]

View File

@@ -0,0 +1,12 @@
test_records = [[{
"doctype": "Holiday List",
"holiday_list_name": "_Test Holiday List",
"fiscal_year": "_Test Fiscal Year 2013"
}, {
"doctype": "Holiday",
"parent": "_Test Holiday List",
"parenttype": "Holiday List",
"parentfield": "holiday_list_details",
"holiday_date": "2013-01-01",
"description": "New Year"
}]]

View File

@@ -1,9 +1,6 @@
import sys
import webnotes
import unittest
if __name__=="__main__":
sys.path.extend([".", "app", "lib"])
from hr.doctype.leave_application.leave_application import LeaveDayBlockedError
class TestLeaveApplication(unittest.TestCase):
@@ -54,13 +51,3 @@ test_records = [
"employee": "_T-Employee-0001",
"company": "_Test Company"
}]]
if __name__=="__main__":
import webnotes
webnotes.connect()
from webnotes.test_runner import make_test_records
make_test_records("Leave Application")
unittest.main()

View File

@@ -20,10 +20,4 @@ import webnotes
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
test_records = [
[{
"leave_type_name": "_Test Leave Type",
"doctype": "Leave Type"
}]
]

View File

@@ -0,0 +1,6 @@
test_records = [
[{
"leave_type_name": "_Test Leave Type",
"doctype": "Leave Type"
}]
]