mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-22 06:29:20 +00:00
refactor(test): make serial no deterministic
This commit is contained in:
@@ -23,6 +23,11 @@ from erpnext.tests.utils import ERPNextTestSuite
|
|||||||
|
|
||||||
|
|
||||||
class TestSerialNo(ERPNextTestSuite):
|
class TestSerialNo(ERPNextTestSuite):
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
|
super().setUpClass()
|
||||||
|
cls.load_test_records("Stock Entry")
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
frappe.db.rollback()
|
frappe.db.rollback()
|
||||||
|
|
||||||
@@ -34,6 +39,7 @@ class TestSerialNo(ERPNextTestSuite):
|
|||||||
sr.warehouse = "_Test Warehouse - _TC"
|
sr.warehouse = "_Test Warehouse - _TC"
|
||||||
sr.serial_no = "_TCSER0001"
|
sr.serial_no = "_TCSER0001"
|
||||||
sr.purchase_rate = 10
|
sr.purchase_rate = 10
|
||||||
|
sr.company = self.companies[0].name
|
||||||
self.assertRaises(SerialNoCannotCreateDirectError, sr.insert)
|
self.assertRaises(SerialNoCannotCreateDirectError, sr.insert)
|
||||||
|
|
||||||
sr.warehouse = None
|
sr.warehouse = None
|
||||||
@@ -193,7 +199,12 @@ class TestSerialNo(ERPNextTestSuite):
|
|||||||
for serial_no in serial_nos:
|
for serial_no in serial_nos:
|
||||||
if not frappe.db.exists("Serial No", serial_no):
|
if not frappe.db.exists("Serial No", serial_no):
|
||||||
frappe.get_doc(
|
frappe.get_doc(
|
||||||
{"doctype": "Serial No", "item_code": item_code, "serial_no": serial_no}
|
{
|
||||||
|
"doctype": "Serial No",
|
||||||
|
"item_code": item_code,
|
||||||
|
"serial_no": serial_no,
|
||||||
|
"company": self.companies[0].name,
|
||||||
|
}
|
||||||
).insert()
|
).insert()
|
||||||
|
|
||||||
make_stock_entry(
|
make_stock_entry(
|
||||||
|
|||||||
Reference in New Issue
Block a user