From a0c41b70c4782f51d250e12529f62133482d783a Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 18 Jan 2017 14:14:20 +0530 Subject: [PATCH] [fix] tax rule test --- .../selling/doctype/customer/test_customer.py | 5 -- erpnext/shopping_cart/cart.py | 1 + erpnext/tests/utils.py | 51 ++++++++++--------- 3 files changed, 28 insertions(+), 29 deletions(-) diff --git a/erpnext/selling/doctype/customer/test_customer.py b/erpnext/selling/doctype/customer/test_customer.py index ac8815d9e4..0d74d23eb4 100644 --- a/erpnext/selling/doctype/customer/test_customer.py +++ b/erpnext/selling/doctype/customer/test_customer.py @@ -27,11 +27,6 @@ class TestCustomer(unittest.TestCase): def test_party_details(self): from erpnext.accounts.party import get_party_details - frappe.db.sql('delete from tabContact') - frappe.db.sql('delete from tabAddress') - frappe.db.sql('delete from `tabDynamic Link`') - - to_check = { 'selling_price_list': None, 'customer_group': '_Test Customer Group', diff --git a/erpnext/shopping_cart/cart.py b/erpnext/shopping_cart/cart.py index a51f6f3425..b427b94066 100644 --- a/erpnext/shopping_cart/cart.py +++ b/erpnext/shopping_cart/cart.py @@ -160,6 +160,7 @@ def decorate_quotation_doc(doc): return doc def _get_cart_quotation(party=None): + '''Return the open Quotation of type "Shopping Cart" or make a new one''' if not party: party = get_party() diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index 8d24f5e644..7024b0db92 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -6,28 +6,31 @@ from __future__ import unicode_literals import frappe def create_test_contact_and_address(): - if not frappe.db.exists('Address', '_Test Address for Customer-Office'): - 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() + frappe.db.sql('delete from tabContact') + frappe.db.sql('delete from tabAddress') + frappe.db.sql('delete from `tabDynamic Link`') - if not frappe.db.exists('Contact', '_Test Contact for _Test Customer-_Test Customer'): - frappe.get_doc(dict( - doctype='Contact', - email_id='test_contact_customer@example.com', - phone='+91 0000000000', - first_name='_Test Contact for _Test Customer', - links = [dict( - link_doctype='Customer', - link_name='_Test Customer' - )] - )).insert() + frappe.get_doc(dict( + doctype='Address', + address_title='_Test Address for Customer', + address_type='Office', + address_line1='Station Road', + city='_Test City', + state='Test State', + country='India', + links = [dict( + link_doctype='Customer', + link_name='_Test Customer' + )] + )).insert() + + frappe.get_doc(dict( + doctype='Contact', + email_id='test_contact_customer@example.com', + phone='+91 0000000000', + first_name='_Test Contact for _Test Customer', + links = [dict( + link_doctype='Customer', + link_name='_Test Customer' + )] + )).insert()