mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-14 18:51:21 +00:00
refactor(test): make item deterministic
This commit is contained in:
@@ -246,6 +246,7 @@ class ERPNextTestSuite(unittest.TestCase):
|
||||
cls.make_quality_inspection_param()
|
||||
cls.make_quality_inspection_template()
|
||||
cls.make_employees()
|
||||
cls.make_brand()
|
||||
cls.update_selling_settings()
|
||||
cls.update_stock_settings()
|
||||
cls.update_system_settings()
|
||||
@@ -2919,6 +2920,31 @@ class ERPNextTestSuite(unittest.TestCase):
|
||||
)
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def make_brand(cls):
|
||||
records = [
|
||||
{"brand": "_Test Brand", "doctype": "Brand"},
|
||||
{
|
||||
"brand": "_Test Brand With Item Defaults",
|
||||
"doctype": "Brand",
|
||||
"brand_defaults": [
|
||||
{
|
||||
"company": "_Test Company",
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"income_account": "_Test Account Sales - _TC",
|
||||
"buying_cost_center": "_Test Cost Center - _TC",
|
||||
"selling_cost_center": "_Test Cost Center - _TC",
|
||||
}
|
||||
],
|
||||
},
|
||||
]
|
||||
cls.brand = []
|
||||
for x in records:
|
||||
if not frappe.db.exists("Brand", {"brand": x.get("brand")}):
|
||||
cls.brand.append(frappe.get_doc(x).insert())
|
||||
else:
|
||||
cls.brand.append(frappe.get_doc("Brand", {"Brand": x.get("brand")}))
|
||||
|
||||
@contextmanager
|
||||
def set_user(self, user: str):
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user