Test case fixes

This commit is contained in:
Nabin Hait 2015-03-10 12:15:04 +05:30
parent 15e4833785
commit c8c1d1c693
5 changed files with 6 additions and 18 deletions

View File

@ -88,19 +88,17 @@ class TestSalesInvoice(unittest.TestCase):
# change shipping to $2
si.get("taxes")[0].tax_amount = 2
si.insert()
expected_values = {
"keys": ["price_list_rate", "discount_percentage", "rate", "amount",
"base_price_list_rate", "base_rate", "base_amount"],
"_Test Item Home Desktop 100": [1, 0, 1, 10, 50, 50, 500],
"_Test Item Home Desktop 200": [3, 0, 3, 15, 150, 150, 750],
"_Test Item Home Desktop 100": [50, 0, 50, 500, 2500, 2500, 25000],
"_Test Item Home Desktop 200": [150, 0, 150, 750, 7500, 7500, 37500],
}
# check if children are saved
self.assertEquals(len(si.get("items")),
len(expected_values)-1)
self.assertEquals(len(si.get("items")), len(expected_values)-1)
# check if item values are calculated
for d in si.get("items"):
@ -108,8 +106,8 @@ class TestSalesInvoice(unittest.TestCase):
self.assertEquals(d.get(k), expected_values[d.item_code][i])
# check net total
self.assertEquals(si.base_net_total, 1250)
self.assertEquals(si.net_total, 25)
self.assertEquals(si.net_total, 1250)
self.assertEquals(si.base_net_total, 62500)
# check tax calculation
expected_values = {

View File

@ -115,10 +115,6 @@ class TestPurchaseOrder(unittest.TestCase):
po.get("items")[0].qty = 3.4
self.assertRaises(UOMMustBeIntegerError, po.insert)
def test_recurring_order(self):
from erpnext.controllers.tests.test_recurring_document import test_recurring_document
test_recurring_document(self, test_records)
def _get_ordered_qty(self, item_code, warehouse):
return flt(frappe.db.get_value("Bin", {"item_code": item_code, "warehouse": warehouse}, "ordered_qty"))

View File

@ -7,7 +7,6 @@ import frappe.permissions
from erpnext.controllers.recurring_document import date_field_map
def test_recurring_document(obj, test_records):
pass
from frappe.utils import get_first_day, get_last_day, add_to_date, nowdate, getdate, add_days
from erpnext.accounts.utils import get_fiscal_year
frappe.db.set_value("Print Settings", "Print Settings", "send_print_as_pdf", 1)
@ -104,7 +103,6 @@ def test_recurring_document(obj, test_records):
_test_recurring_document(obj, doc7, date_field, True)
def _test_recurring_document(obj, base_doc, date_field, first_and_last_day):
pass
from frappe.utils import add_months, get_last_day
from erpnext.controllers.recurring_document import manage_recurring_documents, \
get_next_date

View File

@ -93,6 +93,7 @@ def make_prod_order(self):
"qty": 1,
"wip_warehouse": "_Test Warehouse - _TC",
"fg_warehouse": "_Test Warehouse 1 - _TC",
"company": "_Test Company"
})
test_records = frappe.get_test_records('Time Log')

View File

@ -386,11 +386,6 @@ class TestSalesOrder(unittest.TestCase):
self.assertRaises(frappe.CancelledLinkError, delivery_note.submit)
def test_recurring_order(self):
from erpnext.controllers.tests.test_recurring_document import test_recurring_document
test_recurring_document(self, test_records)
test_dependencies = ["Sales BOM", "Currency Exchange"]
test_records = frappe.get_test_records('Sales Order')