refactor(test): hardcoded names over dynamic ones

Much faster bootstrap without those get_doc calls
This commit is contained in:
ruthra kumar
2026-03-01 21:33:45 +05:30
parent 5a4a77f5d2
commit e67165d6ce
26 changed files with 67 additions and 58 deletions

View File

@@ -17,7 +17,7 @@ class TestProject(ERPNextTestSuite):
from erpnext.setup.doctype.employee.test_employee import make_employee
project_name = "Test Project Costing"
employee = make_employee("employee@frappe.io", company=self.companies[0].name)
employee = make_employee("employee@frappe.io", company="_Test Company")
project = make_project({"project_name": project_name})
timesheet = make_timesheet(
employee=employee,

View File

@@ -15,7 +15,7 @@ class TestTask(ERPNextTestSuite):
from erpnext.setup.doctype.employee.test_employee import make_employee
project_name = "Test Project Costing"
employee = make_employee("employee@frappe.io", company=self.companies[0].name)
employee = make_employee("employee@frappe.io", company="_Test Company")
project = make_project({"project_name": project_name})
task = create_task("_Test Task 1")
task.project = project.name

View File

@@ -64,7 +64,7 @@ class TestTimesheet(ERPNextTestSuite):
)
def test_timesheet_base_amount(self):
emp = make_employee("test_employee_6@salary.com", company=self.companies[0].name)
emp = make_employee("test_employee_6@salary.com", company="_Test Company")
timesheet = make_timesheet(emp, simulate=True, is_billable=1)
self.assertEqual(timesheet.time_logs[0].base_billing_rate, 50)
@@ -73,7 +73,7 @@ class TestTimesheet(ERPNextTestSuite):
self.assertEqual(timesheet.time_logs[0].base_costing_amount, 40)
def test_timesheet_billing_amount(self):
emp = make_employee("test_employee_6@salary.com", company=self.companies[0].name)
emp = make_employee("test_employee_6@salary.com", company="_Test Company")
timesheet = make_timesheet(emp, simulate=True, is_billable=1)
self.assertEqual(timesheet.total_hours, 2)
@@ -83,7 +83,7 @@ class TestTimesheet(ERPNextTestSuite):
self.assertEqual(timesheet.total_billable_amount, 100)
def test_timesheet_billing_amount_not_billable(self):
emp = make_employee("test_employee_6@salary.com", company=self.companies[0].name)
emp = make_employee("test_employee_6@salary.com", company="_Test Company")
timesheet = make_timesheet(emp, simulate=True, is_billable=0)
self.assertEqual(timesheet.total_hours, 2)
@@ -93,7 +93,7 @@ class TestTimesheet(ERPNextTestSuite):
self.assertEqual(timesheet.total_billable_amount, 0)
def test_sales_invoice_from_timesheet(self):
emp = make_employee("test_employee_6@salary.com", company=self.companies[0].name)
emp = make_employee("test_employee_6@salary.com", company="_Test Company")
timesheet = make_timesheet(emp, simulate=True, is_billable=1)
sales_invoice = make_sales_invoice(timesheet.name, "_Test Item", "_Test Customer", currency="INR")
@@ -111,7 +111,7 @@ class TestTimesheet(ERPNextTestSuite):
@ERPNextTestSuite.change_settings("Projects Settings", {"fetch_timesheet_in_sales_invoice": 1})
def test_timesheet_billing_based_on_project(self):
emp = make_employee("test_employee_6@salary.com", company=self.companies[0].name)
emp = make_employee("test_employee_6@salary.com", company="_Test Company")
project = frappe.get_value("Project", {"project_name": "_Test Project"})
timesheet = make_timesheet(
@@ -127,7 +127,7 @@ class TestTimesheet(ERPNextTestSuite):
self.assertEqual(ts.time_logs[0].sales_invoice, sales_invoice.name)
def test_timesheet_time_overlap(self):
emp = make_employee("test_employee_6@salary.com", company=self.companies[0].name)
emp = make_employee("test_employee_6@salary.com", company="_Test Company")
settings = frappe.get_single("Projects Settings")
initial_setting = settings.ignore_employee_time_overlap
@@ -183,7 +183,7 @@ class TestTimesheet(ERPNextTestSuite):
settings.save()
def test_timesheet_not_overlapping_with_continuous_timelogs(self):
emp = make_employee("test_employee_6@salary.com", company=self.companies[0].name)
emp = make_employee("test_employee_6@salary.com", company="_Test Company")
update_activity_type("_Test Activity Type")
timesheet = frappe.new_doc("Timesheet")
@@ -212,7 +212,7 @@ class TestTimesheet(ERPNextTestSuite):
timesheet.save() # should not throw an error
def test_to_time(self):
emp = make_employee("test_employee_6@salary.com", company=self.companies[0].name)
emp = make_employee("test_employee_6@salary.com", company="_Test Company")
from_time = now_datetime()
timesheet = frappe.new_doc("Timesheet")
@@ -278,7 +278,7 @@ class TestTimesheet(ERPNextTestSuite):
This test ensures Timesheet status is recalculated correctly
across billing and return lifecycle events.
"""
emp = make_employee("test_employee_6@salary.com", company=self.companies[0].name)
emp = make_employee("test_employee_6@salary.com", company="_Test Company")
timesheet = make_timesheet(emp, simulate=True, is_billable=1, do_not_submit=True)
timesheet_detail = timesheet.append("time_logs", {})