From da7b1673c30217ed2d424cc2b7761f5cf16d4425 Mon Sep 17 00:00:00 2001 From: Mangesh-Khairnar Date: Fri, 26 Apr 2019 01:31:05 +0530 Subject: [PATCH] test: track pi and pr changes --- .../test_procurement_tracker.py | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/erpnext/buying/report/procurement_tracker/test_procurement_tracker.py b/erpnext/buying/report/procurement_tracker/test_procurement_tracker.py index 7faf48deb0..32975e8910 100644 --- a/erpnext/buying/report/procurement_tracker/test_procurement_tracker.py +++ b/erpnext/buying/report/procurement_tracker/test_procurement_tracker.py @@ -7,15 +7,22 @@ from frappe.utils import nowdate, add_months from erpnext.buying.report.procurement_tracker.procurement_tracker import execute from erpnext.stock.doctype.material_request.test_material_request import make_material_request from erpnext.stock.doctype.material_request.material_request import make_purchase_order +from erpnext.buying.doctype.purchase_order.purchase_order import make_purchase_receipt, make_purchase_invoice class TestProcurementTracker(unittest.TestCase): def test_result_for_procurement_tracker(self): mr = make_material_request() - + mr.submit() po = make_purchase_order(mr.name) - po.get("Items")[0].cost_center = "_Test Cost Center - _TC" - po.get("Items")[0].amount = 1000 + po.supplier = "_Test Supplier" + po.get("items")[0].cost_center = "_Test Cost Center - _TC" + po.get("items")[0].amount = 1000 + po.get("items")[0].base_amount = 1000 po.submit() + pr = make_purchase_receipt(po.name) + pr.submit() + pi = make_purchase_invoice(po.name) + pi.submit() report = execute() expected_data = { @@ -25,19 +32,19 @@ class TestProcurementTracker(unittest.TestCase): "requesting_site": "_Test Warehouse - _TC", "requestor": "Administrator", "material_request_no": mr.name, - "description": '', + "description": '_Test Item 1', "quantity": 10, "unit_of_measurement": "_Test UOM", "status": "To Receive and Bill", "purchase_order_date": nowdate(), "purchase_order": po.name, - "supplier": '', - "estimated_cost": '', - "actual_cost": '', + "supplier": "_Test Supplier", + "estimated_cost": 0.0, + "actual_cost": 1000, "purchase_order_amt": 1000, "purchase_order_amt_usd": 1000, "expected_delivery_date": nowdate(), - "actual_delivery_date": '' + "actual_delivery_date": nowdate() } length = len(report[1]) - self.assertEqual(expected_data, report[length]) \ No newline at end of file + self.assertEqual(expected_data, report[1][length-1]) \ No newline at end of file