fixed Test Cases

This commit is contained in:
Neil Trini Lasrado 2015-08-13 17:10:53 +05:30
parent 6cce304b27
commit 68f66a7e8b
3 changed files with 11 additions and 2 deletions

View File

@ -106,4 +106,11 @@ class TestItem(unittest.TestCase):
variant.item_name = "_Test Variant Item-S"
variant.save()
def make_item_variant():
if not frappe.db.exists("Item", "_Test Variant Item-S"):
variant = create_variant("_Test Variant Item", """{"Test Size": "Small"}""")
variant.item_code = "_Test Variant Item-S"
variant.item_name = "_Test Variant Item-S"
variant.save()
test_records = frappe.get_test_records('Item')

View File

@ -42,6 +42,6 @@ class ItemAttribute(Document):
variant_attributes = frappe.db.sql("select DISTINCT attribute_value from `tabVariant Attribute` where attribute=%s", self.name)
if variant_attributes:
for d in variant_attributes:
if d[0] not in attribute_values:
if d[0] and d[0] not in attribute_values:
frappe.throw(_("Attribute Value {0} cannot be removed from {1} as Item Variants \
exist with this Attribute.").format(d[0], self.name))

View File

@ -64,8 +64,10 @@ class TestStockEntry(unittest.TestCase):
self.assertEqual([[1, 20],[1, 30]], eval(sle.stock_queue))
frappe.db.set_default("allow_negative_stock", 0)
def test_auto_material_request(self):
from erpnext.stock.doctype.item.test_item import make_item_variant
make_item_variant()
self._test_auto_material_request("_Test Item")
def test_auto_material_request_for_variant(self):