mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-23 06:59:20 +00:00
[test] fixed circular dependencies
This commit is contained in:
@@ -11,8 +11,6 @@ from erpnext.exceptions import PartyFrozen, PartyDisabled
|
|||||||
|
|
||||||
test_ignore = ["Price List"]
|
test_ignore = ["Price List"]
|
||||||
|
|
||||||
test_dependencies = ['Quotation']
|
|
||||||
|
|
||||||
test_records = frappe.get_test_records('Customer')
|
test_records = frappe.get_test_records('Customer')
|
||||||
|
|
||||||
class TestCustomer(unittest.TestCase):
|
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 - 1", duplicate_customer.name)
|
||||||
self.assertEquals(test_customer_1.customer_name, duplicate_customer.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):
|
def get_customer_dict(customer_name):
|
||||||
return {
|
return {
|
||||||
"customer_group": "_Test Customer Group",
|
"customer_group": "_Test Customer Group",
|
||||||
|
|||||||
@@ -68,6 +68,47 @@ class TestQuotation(unittest.TestCase):
|
|||||||
self.assertEquals(quotation.get("items")[0].rate, total_margin)
|
self.assertEquals(quotation.get("items")[0].rate, total_margin)
|
||||||
si.save()
|
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')
|
test_records = frappe.get_test_records('Quotation')
|
||||||
|
|
||||||
def get_quotation_dict(customer=None, item_code=None):
|
def get_quotation_dict(customer=None, item_code=None):
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ from __future__ import unicode_literals
|
|||||||
import frappe
|
import frappe
|
||||||
test_records = frappe.get_test_records('Address')
|
test_records = frappe.get_test_records('Address')
|
||||||
|
|
||||||
test_dependencies = ['Customer']
|
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
import frappe
|
import frappe
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user