[test] fixed circular dependencies

This commit is contained in:
Rushabh Mehta 2016-04-08 17:55:11 +05:30
parent bdefa2414f
commit 6fe962e6ad
3 changed files with 41 additions and 45 deletions

View File

@ -11,8 +11,6 @@ from erpnext.exceptions import PartyFrozen, PartyDisabled
test_ignore = ["Price List"]
test_dependencies = ['Quotation']
test_records = frappe.get_test_records('Customer')
class TestCustomer(unittest.TestCase):
@ -113,47 +111,6 @@ class TestCustomer(unittest.TestCase):
self.assertEquals("_Test Customer 1 - 1", duplicate_customer.name)
self.assertEquals(test_customer_1.customer_name, duplicate_customer.customer_name)
def test_party_status_open(self):
from erpnext.selling.doctype.quotation.test_quotation import get_quotation_dict
customer = frappe.get_doc(get_customer_dict('Party Status Test')).insert()
self.assertEquals(frappe.db.get_value('Customer', customer.name, 'status'), 'Active')
quotation = frappe.get_doc(get_quotation_dict(customer=customer.name)).insert()
self.assertEquals(frappe.db.get_value('Customer', customer.name, 'status'), 'Open')
quotation.submit()
self.assertEquals(frappe.db.get_value('Customer', customer.name, 'status'), 'Active')
quotation.cancel()
quotation.delete()
customer.delete()
def test_party_status_close(self):
from erpnext.selling.doctype.quotation.test_quotation import get_quotation_dict
customer = frappe.get_doc(get_customer_dict('Party Status Test')).insert()
self.assertEquals(frappe.db.get_value('Customer', customer.name, 'status'), 'Active')
# open quotation
quotation = frappe.get_doc(get_quotation_dict(customer=customer.name)).insert()
self.assertEquals(frappe.db.get_value('Customer', customer.name, 'status'), 'Open')
# close quotation (submit)
quotation.submit()
quotation1 = frappe.get_doc(get_quotation_dict(customer=customer.name)).insert()
# still open
self.assertEquals(frappe.db.get_value('Customer', customer.name, 'status'), 'Open')
quotation.cancel()
quotation.delete()
quotation1.delete()
customer.delete()
def get_customer_dict(customer_name):
return {
"customer_group": "_Test Customer Group",

View File

@ -68,6 +68,47 @@ class TestQuotation(unittest.TestCase):
self.assertEquals(quotation.get("items")[0].rate, total_margin)
si.save()
def test_party_status_open(self):
from erpnext.selling.doctype.customer.test_customer import get_customer_dict
customer = frappe.get_doc(get_customer_dict('Party Status Test')).insert()
self.assertEquals(frappe.db.get_value('Customer', customer.name, 'status'), 'Active')
quotation = frappe.get_doc(get_quotation_dict(customer=customer.name)).insert()
self.assertEquals(frappe.db.get_value('Customer', customer.name, 'status'), 'Open')
quotation.submit()
self.assertEquals(frappe.db.get_value('Customer', customer.name, 'status'), 'Active')
quotation.cancel()
quotation.delete()
customer.delete()
def test_party_status_close(self):
from erpnext.selling.doctype.customer.test_customer import get_customer_dict
customer = frappe.get_doc(get_customer_dict('Party Status Test')).insert()
self.assertEquals(frappe.db.get_value('Customer', customer.name, 'status'), 'Active')
# open quotation
quotation = frappe.get_doc(get_quotation_dict(customer=customer.name)).insert()
self.assertEquals(frappe.db.get_value('Customer', customer.name, 'status'), 'Open')
# close quotation (submit)
quotation.submit()
quotation1 = frappe.get_doc(get_quotation_dict(customer=customer.name)).insert()
# still open
self.assertEquals(frappe.db.get_value('Customer', customer.name, 'status'), 'Open')
quotation.cancel()
quotation.delete()
quotation1.delete()
customer.delete()
test_records = frappe.get_test_records('Quotation')
def get_quotation_dict(customer=None, item_code=None):

View File

@ -6,8 +6,6 @@ from __future__ import unicode_literals
import frappe
test_records = frappe.get_test_records('Address')
test_dependencies = ['Customer']
import unittest
import frappe