From 7385b734492be1136b3890912a3d8308ec44b8db Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 17 Jan 2017 15:26:49 +0530 Subject: [PATCH] [fix] test --- .../selling/doctype/customer/test_customer.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/erpnext/selling/doctype/customer/test_customer.py b/erpnext/selling/doctype/customer/test_customer.py index f78354abc4..d8497a9e53 100644 --- a/erpnext/selling/doctype/customer/test_customer.py +++ b/erpnext/selling/doctype/customer/test_customer.py @@ -16,12 +16,21 @@ test_ignore = ["Price List"] test_records = frappe.get_test_records('Customer') class TestCustomer(unittest.TestCase): + def setUp(self): + if not frappe.get_value('Item', '_Test Item'): + make_test_records('Item') + def tearDown(self): frappe.db.set_value("Customer", '_Test Customer', 'credit_limit', 0.0) 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', @@ -31,8 +40,8 @@ class TestCustomer(unittest.TestCase): 'contact_email': 'test_contact_customer@example.com', 'contact_mobile': None, 'sales_team': [], - 'contact_display': '_Test Contact For _Test Customer', - 'contact_person': '_Test Contact For _Test Customer-_Test Customer', + 'contact_display': '_Test Contact for _Test Customer', + 'contact_person': '_Test Contact for _Test Customer-_Test Customer', 'territory': u'_Test Territory', 'contact_phone': '+91 0000000000', 'customer_name': '_Test Customer' @@ -53,6 +62,8 @@ class TestCustomer(unittest.TestCase): contact = 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', @@ -68,9 +79,6 @@ class TestCustomer(unittest.TestCase): 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`