Test case fixes

This commit is contained in:
Nabin Hait 2014-09-13 11:56:19 +05:30
parent 034ac6b00b
commit 36cf4a4708
7 changed files with 18 additions and 28 deletions

View File

@ -1,10 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and Contributors
# See license.txt
import frappe
import unittest
test_records = frappe.get_test_records('GL Entry')
class TestGLEntry(unittest.TestCase):
pass

View File

@ -1,6 +0,0 @@
[
{
"doctype": "GL Entry",
"name": "_Test GL Entry 1"
}
]

View File

@ -69,18 +69,18 @@ class TestJournalVoucher(unittest.TestCase):
advance_paid = frappe.db.sql("""select advance_paid from `tab%s`
where name=%s""" % (test_voucher.doctype, '%s'), (test_voucher.name))
payment_against_order = base_jv.get("entries")[0].get(dr_or_cr)
self.assertTrue(flt(advance_paid[0][0]) == flt(payment_against_order))
def cancel_against_voucher_testcase(self, test_voucher):
if test_voucher.doctype == "Journal Voucher":
# if test_voucher is a Journal Voucher, test cancellation of test_voucher
# if test_voucher is a Journal Voucher, test cancellation of test_voucher
test_voucher.cancel()
self.assertTrue(not frappe.db.sql("""select name from `tabJournal Voucher Detail`
where against_jv=%s""", test_voucher.name))
elif test_voucher.doctype in ["Sales Order", "Purchase Order"]:
# if test_voucher is a Sales Order/Purchase Order, test error on cancellation of test_voucher
# if test_voucher is a Sales Order/Purchase Order, test error on cancellation of test_voucher
submitted_voucher = frappe.get_doc(test_voucher.doctype, test_voucher.name)
self.assertRaises(frappe.LinkExistsError, submitted_voucher.cancel)

View File

@ -6,7 +6,9 @@
"doctype": "Journal Voucher",
"entries": [
{
"account": "_Test Customer - _TC",
"account": "_Test Receivable - _TC",
"party_type": "Customer",
"party": "_Test Customer",
"credit": 400.0,
"debit": 0.0,
"doctype": "Journal Voucher Detail",
@ -33,7 +35,9 @@
"doctype": "Journal Voucher",
"entries": [
{
"account": "_Test Supplier - _TC",
"account": "_Test Payable - _TC",
"party_type": "Supplier",
"party": "_Test Supplier",
"credit": 0.0,
"debit": 400.0,
"doctype": "Journal Voucher Detail",
@ -60,7 +64,9 @@
"doctype": "Journal Voucher",
"entries": [
{
"account": "_Test Customer - _TC",
"account": "_Test Receivable - _TC",
"party_type": "Customer",
"party": "_Test Customer",
"credit": 0.0,
"debit": 400.0,
"doctype": "Journal Voucher Detail",

View File

@ -5,16 +5,12 @@ from __future__ import unicode_literals
import frappe
from frappe import _
default_mail_footer = """<div style="padding: 7px; text-align: right; color: #888"><small>Sent via
<a style="color: #888" href="http://erpnext.org">ERPNext</a></div>"""
def after_install():
frappe.get_doc({'doctype': "Role", "role_name": "Analytics"}).insert()
set_single_defaults()
from erpnext.accounts.doctype.chart_of_accounts.import_charts import import_charts
import_charts()
frappe.db.set_default('desktop:home_page', 'setup-wizard')
feature_setup()
from erpnext.setup.page.setup_wizard.setup_wizard import add_all_roles_to

View File

@ -802,6 +802,8 @@ def make_return_jv(stock_entry):
for r in result:
jv.append("entries", {
"account": r.get("account"),
"party_type": r.get("party_type"),
"party": r.get("party"),
"against_invoice": r.get("against_invoice"),
"against_voucher": r.get("against_voucher"),
"balance": get_balance_on(r.get("account"), se.posting_date) if r.get("account") else 0

View File

@ -370,9 +370,11 @@ class TestStockEntry(unittest.TestCase):
self.assertEqual(len(jv.get("entries")), 2)
self.assertEqual(jv.get("voucher_type"), "Credit Note")
self.assertEqual(jv.get("posting_date"), se.posting_date)
self.assertEqual(jv.get("entries")[0].get("account"), "_Test Customer - _TC")
self.assertEqual(jv.get("entries")[1].get("account"), "Sales - _TC")
self.assertEqual(jv.get("entries")[0].get("account"), "_Test Receivable - _TC")
self.assertEqual(jv.get("entries")[0].get("party_type"), "Customer")
self.assertEqual(jv.get("entries")[0].get("party"), "_Test Customer")
self.assertTrue(jv.get("entries")[0].get("against_invoice"))
self.assertEqual(jv.get("entries")[1].get("account"), "Sales - _TC")
def test_make_return_jv_for_sales_invoice_non_packing_item(self):
self._clear_stock_account_balance()