mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-29 18:04:46 +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,
|
execute,
|
||||||
)
|
)
|
||||||
from erpnext.crm.report.sales_pipeline_analytics.test_sales_pipeline_analytics import (
|
from erpnext.crm.report.sales_pipeline_analytics.test_sales_pipeline_analytics import (
|
||||||
create_company,
|
|
||||||
create_customer,
|
|
||||||
create_opportunity,
|
create_opportunity,
|
||||||
)
|
)
|
||||||
from erpnext.tests.utils import ERPNextTestSuite
|
from erpnext.tests.utils import ERPNextTestSuite
|
||||||
@@ -13,8 +11,6 @@ class TestOpportunitySummaryBySalesStage(ERPNextTestSuite):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
super().setUpClass()
|
super().setUpClass()
|
||||||
create_company()
|
|
||||||
create_customer()
|
|
||||||
create_opportunity()
|
create_opportunity()
|
||||||
|
|
||||||
def test_opportunity_summary_by_sales_stage(self):
|
def test_opportunity_summary_by_sales_stage(self):
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ from erpnext.tests.utils import ERPNextTestSuite
|
|||||||
|
|
||||||
class TestSalesPipelineAnalytics(ERPNextTestSuite):
|
class TestSalesPipelineAnalytics(ERPNextTestSuite):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
create_company()
|
|
||||||
create_customer()
|
|
||||||
create_opportunity()
|
create_opportunity()
|
||||||
|
|
||||||
def test_sales_pipeline_analytics(self):
|
def test_sales_pipeline_analytics(self):
|
||||||
@@ -181,23 +179,6 @@ class TestSalesPipelineAnalytics(ERPNextTestSuite):
|
|||||||
self.assertEqual(expected_data, report[1])
|
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():
|
def create_opportunity():
|
||||||
doc = frappe.db.exists({"doctype": "Opportunity", "party_name": "_Test NC"})
|
doc = frappe.db.exists({"doctype": "Opportunity", "party_name": "_Test NC"})
|
||||||
if not doc:
|
if not doc:
|
||||||
|
|||||||
@@ -162,6 +162,12 @@ class ERPNextTestSuite(unittest.TestCase):
|
|||||||
update_salutations()
|
update_salutations()
|
||||||
|
|
||||||
records = get_preset_records("India")
|
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 = {
|
presets_primary_key_map = {
|
||||||
"Address Template": "country",
|
"Address Template": "country",
|
||||||
"Item Group": "item_group_name",
|
"Item Group": "item_group_name",
|
||||||
@@ -973,6 +979,14 @@ class ERPNextTestSuite(unittest.TestCase):
|
|||||||
"enable_perpetual_inventory": 0,
|
"enable_perpetual_inventory": 0,
|
||||||
"parent_company": "Parent Group Company India",
|
"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 = []
|
cls.companies = []
|
||||||
for x in records:
|
for x in records:
|
||||||
@@ -2526,6 +2540,13 @@ class ERPNextTestSuite(unittest.TestCase):
|
|||||||
"doctype": "Customer",
|
"doctype": "Customer",
|
||||||
"territory": "_Test Territory",
|
"territory": "_Test Territory",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"customer_group": "_Test Customer Group",
|
||||||
|
"customer_name": "_Test NC",
|
||||||
|
"customer_type": "Individual",
|
||||||
|
"doctype": "Customer",
|
||||||
|
"territory": "_Test Territory",
|
||||||
|
},
|
||||||
]
|
]
|
||||||
cls.customer = []
|
cls.customer = []
|
||||||
for x in records:
|
for x in records:
|
||||||
|
|||||||
Reference in New Issue
Block a user