mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-19 04:59:18 +00:00
refactor(test): make department deterministic
This commit is contained in:
@@ -9,18 +9,18 @@ from erpnext.tests.utils import ERPNextTestSuite
|
|||||||
|
|
||||||
class TestDepartment(ERPNextTestSuite):
|
class TestDepartment(ERPNextTestSuite):
|
||||||
def test_remove_department_data(self):
|
def test_remove_department_data(self):
|
||||||
doc = create_department("Test Department")
|
doc = create_department("Test Department", company=self.companies[0].name)
|
||||||
frappe.delete_doc("Department", doc.name)
|
frappe.delete_doc("Department", doc.name)
|
||||||
|
|
||||||
|
|
||||||
def create_department(department_name, parent_department=None):
|
def create_department(department_name, parent_department=None, company=None):
|
||||||
doc = frappe.get_doc(
|
doc = frappe.get_doc(
|
||||||
{
|
{
|
||||||
"doctype": "Department",
|
"doctype": "Department",
|
||||||
"is_group": 0,
|
"is_group": 0,
|
||||||
"parent_department": parent_department,
|
"parent_department": parent_department,
|
||||||
"department_name": department_name,
|
"department_name": department_name,
|
||||||
"company": frappe.defaults.get_defaults().company,
|
"company": frappe.defaults.get_defaults().company or company,
|
||||||
}
|
}
|
||||||
).insert()
|
).insert()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user