diff --git a/erpnext/crm/report/opportunity_summary_by_sales_stage/test_opportunity_summary_by_sales_stage.py b/erpnext/crm/report/opportunity_summary_by_sales_stage/test_opportunity_summary_by_sales_stage.py index 29bc14e04e7..f136294339f 100644 --- a/erpnext/crm/report/opportunity_summary_by_sales_stage/test_opportunity_summary_by_sales_stage.py +++ b/erpnext/crm/report/opportunity_summary_by_sales_stage/test_opportunity_summary_by_sales_stage.py @@ -2,8 +2,6 @@ from erpnext.crm.report.opportunity_summary_by_sales_stage.opportunity_summary_b execute, ) from erpnext.crm.report.sales_pipeline_analytics.test_sales_pipeline_analytics import ( - create_company, - create_customer, create_opportunity, ) from erpnext.tests.utils import ERPNextTestSuite @@ -13,8 +11,6 @@ class TestOpportunitySummaryBySalesStage(ERPNextTestSuite): @classmethod def setUpClass(cls): super().setUpClass() - create_company() - create_customer() create_opportunity() def test_opportunity_summary_by_sales_stage(self): diff --git a/erpnext/crm/report/sales_pipeline_analytics/test_sales_pipeline_analytics.py b/erpnext/crm/report/sales_pipeline_analytics/test_sales_pipeline_analytics.py index dea4b772b65..893218c37ea 100644 --- a/erpnext/crm/report/sales_pipeline_analytics/test_sales_pipeline_analytics.py +++ b/erpnext/crm/report/sales_pipeline_analytics/test_sales_pipeline_analytics.py @@ -8,8 +8,6 @@ from erpnext.tests.utils import ERPNextTestSuite class TestSalesPipelineAnalytics(ERPNextTestSuite): def setUp(self): - create_company() - create_customer() create_opportunity() def test_sales_pipeline_analytics(self): @@ -181,23 +179,6 @@ class TestSalesPipelineAnalytics(ERPNextTestSuite): self.assertEqual(expected_data, report[1]) -def create_company(): - doc = frappe.db.exists("Company", "Best Test") - if not doc: - doc = frappe.new_doc("Company") - doc.company_name = "Best Test" - doc.default_currency = "INR" - doc.insert() - - -def create_customer(): - doc = frappe.db.exists("Customer", "_Test NC") - if not doc: - doc = frappe.new_doc("Customer") - doc.customer_name = "_Test NC" - doc.insert() - - def create_opportunity(): doc = frappe.db.exists({"doctype": "Opportunity", "party_name": "_Test NC"}) if not doc: diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 18ef2e05779..83009b277f8 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -162,6 +162,12 @@ class ERPNextTestSuite(unittest.TestCase): update_salutations() records = get_preset_records("India") + + from erpnext.setup.setup_wizard.operations.install_fixtures import read_lines + + for doctype, title_field, filename in (("UTM Source", "name", "marketing_source.txt"),): + records += [{"doctype": doctype, title_field: title} for title in read_lines(filename)] + presets_primary_key_map = { "Address Template": "country", "Item Group": "item_group_name", @@ -973,6 +979,14 @@ class ERPNextTestSuite(unittest.TestCase): "enable_perpetual_inventory": 0, "parent_company": "Parent Group Company India", }, + { + "abbr": "BT", + "company_name": "Best Test", + "country": "India", + "default_currency": "INR", + "doctype": "Company", + "chart_of_accounts": "Standard", + }, ] cls.companies = [] for x in records: @@ -2526,6 +2540,13 @@ class ERPNextTestSuite(unittest.TestCase): "doctype": "Customer", "territory": "_Test Territory", }, + { + "customer_group": "_Test Customer Group", + "customer_name": "_Test NC", + "customer_type": "Individual", + "doctype": "Customer", + "territory": "_Test Territory", + }, ] cls.customer = [] for x in records: