test: check index creation on item table
This commit is contained in:
parent
b9fa12d572
commit
f5a937bc45
@ -487,6 +487,20 @@ class TestItem(unittest.TestCase):
|
|||||||
new_barcode.barcode_type = 'EAN'
|
new_barcode.barcode_type = 'EAN'
|
||||||
self.assertRaises(InvalidBarcode, item_doc.save)
|
self.assertRaises(InvalidBarcode, item_doc.save)
|
||||||
|
|
||||||
|
def test_index_creation(self):
|
||||||
|
"check if index is getting created in db"
|
||||||
|
from erpnext.stock.doctype.item.item import on_doctype_update
|
||||||
|
on_doctype_update()
|
||||||
|
|
||||||
|
indices = frappe.db.sql("show index from tabItem", as_dict=1)
|
||||||
|
expected_columns = {"item_code", "item_name", "item_group", "route"}
|
||||||
|
for index in indices:
|
||||||
|
expected_columns.discard(index.get("Column_name"))
|
||||||
|
|
||||||
|
if expected_columns:
|
||||||
|
self.fail(f"Expected db index on these columns: {', '.join(expected_columns)}")
|
||||||
|
|
||||||
|
|
||||||
def set_item_variant_settings(fields):
|
def set_item_variant_settings(fields):
|
||||||
doc = frappe.get_doc('Item Variant Settings')
|
doc = frappe.get_doc('Item Variant Settings')
|
||||||
doc.set('fields', fields)
|
doc.set('fields', fields)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user