From 3c6d440f090eb5f1bd1c5c2a0d0a664a8c849656 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 8 Jul 2013 19:47:37 +0530 Subject: [PATCH] [bean] [mandatory] fixes in test cases --- buying/doctype/purchase_order/test_purchase_order.py | 1 + .../doctype/supplier_quotation/test_supplier_quotation.py | 4 ++-- selling/doctype/sales_common/sales_common.py | 2 +- selling/doctype/sales_order/test_sales_order.py | 5 +++-- setup/doctype/currency_exchange/test_currency_exchange.py | 2 +- stock/doctype/stock_entry/test_stock_entry.py | 6 ++++-- stock/doctype/warehouse/test_warehouse.py | 1 + 7 files changed, 13 insertions(+), 8 deletions(-) diff --git a/buying/doctype/purchase_order/test_purchase_order.py b/buying/doctype/purchase_order/test_purchase_order.py index aa3e8c45b8..f1cf34d9eb 100644 --- a/buying/doctype/purchase_order/test_purchase_order.py +++ b/buying/doctype/purchase_order/test_purchase_order.py @@ -55,6 +55,7 @@ class TestPurchaseOrder(unittest.TestCase): self.assertEquals(pi[0]["doctype"], "Purchase Invoice") self.assertEquals(len(pi), len(test_records[0])) + pi[0].bill_no = "NA" webnotes.bean(pi).insert() def test_subcontracting(self): diff --git a/buying/doctype/supplier_quotation/test_supplier_quotation.py b/buying/doctype/supplier_quotation/test_supplier_quotation.py index 540662d7a0..813b2f85b3 100644 --- a/buying/doctype/supplier_quotation/test_supplier_quotation.py +++ b/buying/doctype/supplier_quotation/test_supplier_quotation.py @@ -39,8 +39,8 @@ class TestPurchaseOrder(unittest.TestCase): po[0]["naming_series"] = "_T-Purchase Order-" for doc in po: - if doc.parentfield=="purchase_order_items": - doc.schedule_date = "2013-04-12" + if doc.get("item_code"): + doc["schedule_date"] = "2013-04-12" webnotes.bean(po).insert() diff --git a/selling/doctype/sales_common/sales_common.py b/selling/doctype/sales_common/sales_common.py index b53662e44f..f34ebf917d 100644 --- a/selling/doctype/sales_common/sales_common.py +++ b/selling/doctype/sales_common/sales_common.py @@ -292,7 +292,7 @@ class DocType(TransactionBase): return obj.doclist # delete from doclist - obj.doclist = filter(lambda d: d.name not in delete_list, obj.doclist) + obj.doclist = webnotes.doclist(filter(lambda d: d.name not in delete_list, obj.doclist)) # delete from db webnotes.conn.sql("""\ diff --git a/selling/doctype/sales_order/test_sales_order.py b/selling/doctype/sales_order/test_sales_order.py index 19b888e6de..23046ede3e 100644 --- a/selling/doctype/sales_order/test_sales_order.py +++ b/selling/doctype/sales_order/test_sales_order.py @@ -59,11 +59,12 @@ class TestSalesOrder(unittest.TestCase): def create_so(self, so_doclist = None): if not so_doclist: - so_doclist =test_records[0] - + so_doclist = test_records[0] + w = webnotes.bean(copy=so_doclist) w.insert() w.submit() + return w def create_dn_against_so(self, so, delivered_qty=0): diff --git a/setup/doctype/currency_exchange/test_currency_exchange.py b/setup/doctype/currency_exchange/test_currency_exchange.py index cd0ac21aa7..542b6affee 100644 --- a/setup/doctype/currency_exchange/test_currency_exchange.py +++ b/setup/doctype/currency_exchange/test_currency_exchange.py @@ -3,7 +3,7 @@ test_records = [ "doctype": "Currency Exchange", "from_currency": "USD", "to_currency": "INR", - "exchange_rate": 1 + "exchange_rate": 60.0 }], [{ "doctype": "Currency Exchange", diff --git a/stock/doctype/stock_entry/test_stock_entry.py b/stock/doctype/stock_entry/test_stock_entry.py index 68168605a8..fb045ced7e 100644 --- a/stock/doctype/stock_entry/test_stock_entry.py +++ b/stock/doctype/stock_entry/test_stock_entry.py @@ -363,8 +363,8 @@ class TestStockEntry(unittest.TestCase): def _test_delivery_note_return_against_sales_order(self, item_code, delivered_qty, returned_qty): self._insert_material_receipt() - from selling.doctype.sales_order.test_sales_order \ - import test_records as sales_order_test_records, make_sales_invoice, make_delivery_note + from selling.doctype.sales_order.test_sales_order import test_records as sales_order_test_records + from selling.doctype.sales_order.sales_order import make_sales_invoice, make_delivery_note actual_qty_0 = self._get_actual_qty() @@ -445,6 +445,7 @@ class TestStockEntry(unittest.TestCase): d.cost_center = "_Test Cost Center - _TC" pi.run_method("calculate_taxes_and_totals") + pi.doc.bill_no = "NA" pi.insert() pi.submit() @@ -544,6 +545,7 @@ class TestStockEntry(unittest.TestCase): d.cost_center = "_Test Cost Center - _TC" pi.run_method("calculate_taxes_and_totals") + pi.doc.bill_no = "NA" pi.insert() pi.submit() diff --git a/stock/doctype/warehouse/test_warehouse.py b/stock/doctype/warehouse/test_warehouse.py index f3a04581a9..10b49b67c2 100644 --- a/stock/doctype/warehouse/test_warehouse.py +++ b/stock/doctype/warehouse/test_warehouse.py @@ -9,6 +9,7 @@ test_records = [ "doctype": "Warehouse", "warehouse_name": "_Test Warehouse 1", "warehouse_type": "_Test Warehouse Type", + "company": "_Test Company" }], [{ "doctype": "Warehouse",