From 789b74257eb0977a0f50548a01236b644724389b Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 27 Nov 2014 15:22:24 +0530 Subject: [PATCH] test case fixes --- erpnext/manufacturing/doctype/bom/test_bom.py | 17 ++++++++++++----- erpnext/stock/doctype/item/test_records.json | 6 ++++-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/erpnext/manufacturing/doctype/bom/test_bom.py b/erpnext/manufacturing/doctype/bom/test_bom.py index 753a708a76..a8e7ed281d 100644 --- a/erpnext/manufacturing/doctype/bom/test_bom.py +++ b/erpnext/manufacturing/doctype/bom/test_bom.py @@ -5,6 +5,7 @@ from __future__ import unicode_literals import unittest import frappe +from frappe.utils import cstr test_records = frappe.get_test_records('Bom') @@ -27,16 +28,22 @@ class TestBOM(unittest.TestCase): def test_get_items_list(self): from erpnext.manufacturing.doctype.bom.bom import get_bom_items - self.assertEquals(len(get_bom_items(bom="BOM/_Test FG Item 2/001", qty=1, fetch_exploded=1)), 3) + default_bom = frappe.db.get_value("BOM", {"item":"_Test FG Item 2", "is_default": 1}) + self.assertEquals(len(get_bom_items(bom=default_bom)), 3) def test_default_bom(self): - bom = frappe.get_doc("BOM", "BOM/_Test FG Item 2/001") + def _get_default_bom_in_item(): + return cstr(frappe.db.get_value("Item", "_Test FG Item 2", "default_bom")) + + bom = frappe.get_doc("BOM", {"item":"_Test FG Item 2", "is_default": 1}) + self.assertEqual(_get_default_bom_in_item(), bom.name) + bom.is_active = 0 bom.save() - - self.assertEqual(frappe.db.get_value("Item", "_Test FG Item 2", "default_bom"), "") + self.assertEqual(_get_default_bom_in_item(), "") bom.is_active = 1 + bom.is_default=1 bom.save() - self.assertTrue(frappe.db.get_value("Item", "_Test FG Item 2", "default_bom"), "BOM/_Test FG Item 2/001") + self.assertTrue(_get_default_bom_in_item(), bom.name) diff --git a/erpnext/stock/doctype/item/test_records.json b/erpnext/stock/doctype/item/test_records.json index 7f5271e7b6..7b6130c4e1 100644 --- a/erpnext/stock/doctype/item/test_records.json +++ b/erpnext/stock/doctype/item/test_records.json @@ -18,6 +18,7 @@ "item_code": "_Test Item", "item_group": "_Test Item Group", "item_name": "_Test Item", + "apply_warehouse_wise_reorder_level": 1, "item_reorder": [ { "material_request_type": "Purchase", @@ -40,7 +41,7 @@ "income_account": "Sales - _TC", "inspection_required": "No", "is_asset_item": "No", - "is_pro_applicable": "Yes", + "is_pro_applicable": "No", "is_purchase_item": "Yes", "is_sales_item": "Yes", "is_service_item": "No", @@ -191,7 +192,7 @@ "has_serial_no": "Yes", "inspection_required": "No", "is_asset_item": "No", - "is_pro_applicable": "Yes", + "is_pro_applicable": "No", "is_purchase_item": "Yes", "is_sales_item": "Yes", "is_service_item": "No", @@ -274,6 +275,7 @@ {"item_attribute": "Test Size", "item_attribute_value": "Medium"}, {"item_attribute": "Test Size", "item_attribute_value": "Large"} ], + "apply_warehouse_wise_reorder_level": 1, "item_reorder": [ { "material_request_type": "Purchase",