mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-23 08:38:30 +00:00
refactor(test): make opportunity summary by sales stage deterministic
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user