From d4d02885403a35ce50373f7f74d4a9e6b54c2984 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 27 Feb 2013 18:29:13 +0530 Subject: [PATCH] fixed test case of purchase invoice for auto inventory accounting --- .../doctype/purchase_invoice/test_purchase_invoice.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/accounts/doctype/purchase_invoice/test_purchase_invoice.py index c1c0540824..b9f7ec928b 100644 --- a/accounts/doctype/purchase_invoice/test_purchase_invoice.py +++ b/accounts/doctype/purchase_invoice/test_purchase_invoice.py @@ -54,7 +54,6 @@ class TestPurchaseInvoice(unittest.TestCase): self.assertEqual([d.debit, d.credit], expected_gl_entries.get(d.account)) def test_gl_entries_with_auto_inventory_accounting(self): - print "Testing with auto inventory" webnotes.defaults.set_global_default("auto_inventory_accounting", 1) self.assertEqual(cint(webnotes.defaults.get_global_default("auto_inventory_accounting")), 1) @@ -63,20 +62,18 @@ class TestPurchaseInvoice(unittest.TestCase): pi.insert() pi.submit() - print "auto inventory submitted" - gl_entries = webnotes.conn.sql("""select account, debit, credit - from `tabGL Entry` where voucher_type='Purchase Receipt' and voucher_no=%s - order by account desc""", pi.doc.name, as_dict=1) + from `tabGL Entry` where voucher_type='Purchase Invoice' and voucher_no=%s + order by account asc""", pi.doc.name, as_dict=1) self.assertTrue(gl_entries) - expected_values = [ + expected_values = sorted([ ["_Test Supplier - _TC", 0, 720], ["Stock Received But Not Billed - _TC", 750.0, 0], ["_Test Account Shipping Charges - _TC", 100.0, 0], ["_Test Account VAT - _TC", 120.0, 0], ["Expenses Included In Valuation - _TC", 0, 250.0] - ].sort() + ]) for i, gle in enumerate(gl_entries): self.assertEquals(expected_values[i][0], gle.account)