fix for tests
This commit is contained in:
parent
0b628386de
commit
e07b332514
@ -1,4 +1,4 @@
|
|||||||
[
|
[
|
||||||
{"doctype":"Department", "department_name":"_Test Department"},
|
{"doctype":"Department", "department_name":"_Test Department", "company": "_Test Company"},
|
||||||
{"doctype":"Department", "department_name":"_Test Department 1"}
|
{"doctype":"Department", "department_name":"_Test Department 1", "company": "_Test Company"}
|
||||||
]
|
]
|
@ -3,7 +3,7 @@
|
|||||||
"company": "_Test Company",
|
"company": "_Test Company",
|
||||||
"date_of_birth": "1980-01-01",
|
"date_of_birth": "1980-01-01",
|
||||||
"date_of_joining": "2010-01-01",
|
"date_of_joining": "2010-01-01",
|
||||||
"department": "_Test Department",
|
"department": "_Test Department - _TC",
|
||||||
"doctype": "Employee",
|
"doctype": "Employee",
|
||||||
"employee_name": "_Test Employee",
|
"employee_name": "_Test Employee",
|
||||||
"gender": "Female",
|
"gender": "Female",
|
||||||
@ -15,7 +15,7 @@
|
|||||||
"company": "_Test Company",
|
"company": "_Test Company",
|
||||||
"date_of_birth": "1980-01-01",
|
"date_of_birth": "1980-01-01",
|
||||||
"date_of_joining": "2010-01-01",
|
"date_of_joining": "2010-01-01",
|
||||||
"department": "_Test Department 1",
|
"department": "_Test Department 1 - _TC",
|
||||||
"doctype": "Employee",
|
"doctype": "Employee",
|
||||||
"employee_name": "_Test Employee 1",
|
"employee_name": "_Test Employee 1",
|
||||||
"gender": "Male",
|
"gender": "Male",
|
||||||
@ -27,7 +27,7 @@
|
|||||||
"company": "_Test Company",
|
"company": "_Test Company",
|
||||||
"date_of_birth": "1980-01-01",
|
"date_of_birth": "1980-01-01",
|
||||||
"date_of_joining": "2010-01-01",
|
"date_of_joining": "2010-01-01",
|
||||||
"department": "_Test Department 1",
|
"department": "_Test Department 1 - _TC",
|
||||||
"doctype": "Employee",
|
"doctype": "Employee",
|
||||||
"employee_name": "_Test Employee 2",
|
"employee_name": "_Test Employee 2",
|
||||||
"gender": "Male",
|
"gender": "Male",
|
||||||
|
@ -71,7 +71,7 @@ class TestLeaveApplication(unittest.TestCase):
|
|||||||
add_role("test1@example.com", "Leave Approver")
|
add_role("test1@example.com", "Leave Approver")
|
||||||
clear_user_permissions_for_doctype("Employee")
|
clear_user_permissions_for_doctype("Employee")
|
||||||
|
|
||||||
frappe.db.set_value("Department", "_Test Department",
|
frappe.db.set_value("Department", "_Test Department - _TC",
|
||||||
"leave_block_list", "_Test Leave Block List")
|
"leave_block_list", "_Test Leave Block List")
|
||||||
|
|
||||||
make_allocation_record()
|
make_allocation_record()
|
||||||
@ -214,7 +214,7 @@ class TestLeaveApplication(unittest.TestCase):
|
|||||||
frappe.db.set_value("Leave Block List", "_Test Leave Block List",
|
frappe.db.set_value("Leave Block List", "_Test Leave Block List",
|
||||||
"applies_to_all_departments", 1)
|
"applies_to_all_departments", 1)
|
||||||
frappe.db.set_value("Employee", "_T-Employee-00002", "department",
|
frappe.db.set_value("Employee", "_T-Employee-00002", "department",
|
||||||
"_Test Department")
|
"_Test Department - _TC")
|
||||||
|
|
||||||
frappe.set_user("test1@example.com")
|
frappe.set_user("test1@example.com")
|
||||||
application.insert()
|
application.insert()
|
||||||
|
@ -14,20 +14,20 @@ class TestLeaveBlockList(unittest.TestCase):
|
|||||||
|
|
||||||
def test_get_applicable_block_dates(self):
|
def test_get_applicable_block_dates(self):
|
||||||
frappe.set_user("test@example.com")
|
frappe.set_user("test@example.com")
|
||||||
frappe.db.set_value("Department", "_Test Department", "leave_block_list",
|
frappe.db.set_value("Department", "_Test Department - _TC", "leave_block_list",
|
||||||
"_Test Leave Block List")
|
"_Test Leave Block List")
|
||||||
self.assertTrue(getdate("2013-01-02") in
|
self.assertTrue(getdate("2013-01-02") in
|
||||||
[d.block_date for d in get_applicable_block_dates("2013-01-01", "2013-01-03")])
|
[d.block_date for d in get_applicable_block_dates("2013-01-01", "2013-01-03")])
|
||||||
|
|
||||||
def test_get_applicable_block_dates_for_allowed_user(self):
|
def test_get_applicable_block_dates_for_allowed_user(self):
|
||||||
frappe.set_user("test1@example.com")
|
frappe.set_user("test1@example.com")
|
||||||
frappe.db.set_value("Department", "_Test Department 1", "leave_block_list",
|
frappe.db.set_value("Department", "_Test Department 1 - _TC", "leave_block_list",
|
||||||
"_Test Leave Block List")
|
"_Test Leave Block List")
|
||||||
self.assertEqual([], [d.block_date for d in get_applicable_block_dates("2013-01-01", "2013-01-03")])
|
self.assertEqual([], [d.block_date for d in get_applicable_block_dates("2013-01-01", "2013-01-03")])
|
||||||
|
|
||||||
def test_get_applicable_block_dates_all_lists(self):
|
def test_get_applicable_block_dates_all_lists(self):
|
||||||
frappe.set_user("test1@example.com")
|
frappe.set_user("test1@example.com")
|
||||||
frappe.db.set_value("Department", "_Test Department 1", "leave_block_list",
|
frappe.db.set_value("Department", "_Test Department 1 - _TC", "leave_block_list",
|
||||||
"_Test Leave Block List")
|
"_Test Leave Block List")
|
||||||
self.assertTrue(getdate("2013-01-02") in
|
self.assertTrue(getdate("2013-01-02") in
|
||||||
[d.block_date for d in get_applicable_block_dates("2013-01-01", "2013-01-03", all_lists=True)])
|
[d.block_date for d in get_applicable_block_dates("2013-01-01", "2013-01-03", all_lists=True)])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user