refactor(test): make item price deterministic

This commit is contained in:
ruthra kumar
2025-12-26 17:18:13 +05:30
parent 23cdd82de1
commit 7853b779bd
2 changed files with 60 additions and 4 deletions

View File

@@ -11,10 +11,10 @@ from erpnext.tests.utils import ERPNextTestSuite
class TestItemPrice(ERPNextTestSuite):
def setUp(self):
super().setUp()
frappe.db.sql("delete from `tabItem Price`")
make_test_records_for_doctype("Item Price", force=True)
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.load_test_records("Item Price")
def test_template_item_price(self):
from erpnext.stock.doctype.item.test_item import make_item

View File

@@ -0,0 +1,56 @@
[
{
"doctype": "Item Price",
"item_code": "_Test Item",
"price_list": "_Test Price List",
"price_list_rate": 100,
"valid_from": "2017-04-18",
"valid_upto": "2017-04-26"
},
{
"doctype": "Item Price",
"item_code": "_Test Item",
"price_list": "_Test Price List Rest of the World",
"price_list_rate": 10
},
{
"doctype": "Item Price",
"item_code": "_Test Item 2",
"price_list": "_Test Price List Rest of the World",
"price_list_rate": 20,
"valid_from": "2017-04-18",
"valid_upto": "2017-04-26",
"customer": "_Test Customer",
"uom": "_Test UOM"
},
{
"doctype": "Item Price",
"item_code": "_Test Item Home Desktop 100",
"price_list": "_Test Price List",
"price_list_rate": 1000,
"valid_from": "2017-04-10",
"valid_upto": "2017-04-17"
},
{
"doctype": "Item Price",
"item_code": "_Test Item Home Desktop Manufactured",
"price_list": "_Test Price List",
"price_list_rate": 1000,
"valid_from": "2017-04-10",
"valid_upto": "2017-04-17"
},
{
"doctype": "Item Price",
"item_code": "_Test Item",
"price_list": "_Test Buying Price List",
"price_list_rate": 100,
"supplier": "_Test Supplier"
},
{
"doctype": "Item Price",
"item_code": "_Test Item",
"price_list": "_Test Selling Price List",
"price_list_rate": 200,
"customer": "_Test Customer"
}
]