mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-23 20:16:40 +00:00
refactor(test): hardcoded names over dynamic ones
Much faster bootstrap without those get_doc calls
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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", {})
|
||||
|
||||
Reference in New Issue
Block a user