[fix] tests
diff --git a/erpnext/selling/doctype/customer/test_customer.py b/erpnext/selling/doctype/customer/test_customer.py
index 23df503..f78354a 100644
--- a/erpnext/selling/doctype/customer/test_customer.py
+++ b/erpnext/selling/doctype/customer/test_customer.py
@@ -26,7 +26,7 @@
'selling_price_list': None,
'customer_group': '_Test Customer Group',
'contact_designation': None,
- 'customer_address': '_Test Address-Office',
+ 'customer_address': '_Test Address for Customer-Office',
'contact_department': None,
'contact_email': 'test_contact_customer@example.com',
'contact_mobile': None,
@@ -38,8 +38,28 @@
'customer_name': '_Test Customer'
}
- make_test_records("Address")
- make_test_records("Contact")
+ address = frappe.get_doc(dict(
+ doctype='Address',
+ address_title='_Test Address for Customer',
+ address_type='Office',
+ address_line1='Station Road',
+ city='Mumbai',
+ country='India',
+ links = [dict(
+ link_doctype='Customer',
+ link_name='_Test Customer'
+ )]
+ )).insert()
+
+ contact = frappe.get_doc(dict(
+ doctype='Contact',
+ first_name='_Test Contact for _Test Customer',
+ links = [dict(
+ link_doctype='Customer',
+ link_name='_Test Customer'
+ )]
+ )).insert()
+
frappe.db.set_value("Contact", "_Test Contact For _Test Customer-_Test Customer",
"is_primary_contact", 1)
@@ -48,6 +68,9 @@
for key, value in to_check.iteritems():
self.assertEquals(value, details.get(key))
+ address.delete()
+ contact.delete()
+
def test_rename(self):
for name in ("_Test Customer 1", "_Test Customer 1 Renamed"):
frappe.db.sql("""delete from `tabCommunication`
@@ -117,6 +140,7 @@
self.assertEquals(test_customer_1.customer_name, duplicate_customer.customer_name)
def get_customer_outstanding_amount(self):
+ from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
outstanding_amt = get_customer_outstanding('_Test Customer', '_Test Company')
# If outstanding is negative make a transaction to get positive outstanding amount
@@ -124,7 +148,7 @@
return outstanding_amt
item_qty = int((abs(outstanding_amt) + 200)/100)
- make_sales_order({'qty':item_qty})
+ make_sales_order(qty=item_qty)
return get_customer_outstanding('_Test Customer', '_Test Company')
def test_customer_credit_limit(self):
@@ -138,7 +162,7 @@
if outstanding_amt <= 0.0:
item_qty = int((abs(outstanding_amt) + 200)/100)
- make_sales_order({'qty':item_qty})
+ make_sales_order(qty=item_qty)
if credit_limit == 0.0:
frappe.db.set_value("Customer", '_Test Customer', 'credit_limit', outstanding_amt - 50.0)
@@ -165,11 +189,7 @@
self.assertRaises(frappe.ValidationError, make_sales_order)
def test_customer_credit_limit_on_change(self):
- from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
-
outstanding_amt = self.get_customer_outstanding_amount()
- credit_limit = get_credit_limit('_Test Customer', '_Test Company')
-
customer = frappe.get_doc("Customer", '_Test Customer')
customer.credit_limit = flt(outstanding_amt - 100)
self.assertRaises(frappe.ValidationError, customer.save)
diff --git a/erpnext/shopping_cart/cart.py b/erpnext/shopping_cart/cart.py
index 5ca0315..963514e 100644
--- a/erpnext/shopping_cart/cart.py
+++ b/erpnext/shopping_cart/cart.py
@@ -375,7 +375,7 @@
if not party:
return []
- address_names = frappe.db.get_all('Dyanamic Link', fields=('parent'),
+ address_names = frappe.db.get_all('Dynamic Link', fields=('parent'),
filters=dict(parenttype='Address', link_doctype=party.doctype, link_name=party.name))
out = []
diff --git a/erpnext/shopping_cart/test_shopping_cart.py b/erpnext/shopping_cart/test_shopping_cart.py
index 698d467..52fcf89 100644
--- a/erpnext/shopping_cart/test_shopping_cart.py
+++ b/erpnext/shopping_cart/test_shopping_cart.py
@@ -25,8 +25,8 @@
# test if lead is created and quotation with new lead is fetched
quotation = _get_cart_quotation()
self.assertEquals(quotation.quotation_to, "Customer")
- self.assertEquals(frappe.db.get_value("Contact", dict(contact_person="test_cart_user@example.com")),
- quotation.contact_name)
+ self.assertEquals(frappe.db.get_value("Contact", dict(email_id="test_cart_user@example.com")),
+ quotation.contact_person)
self.assertEquals(quotation.lead, None)
self.assertEquals(quotation.contact_email, frappe.session.user)