test: updated test cases
This commit is contained in:
parent
fedee0e8da
commit
dd0a8f20e2
@ -14,7 +14,8 @@ test_records = frappe.get_test_records('Supplier')
|
|||||||
|
|
||||||
class TestSupplier(unittest.TestCase):
|
class TestSupplier(unittest.TestCase):
|
||||||
def test_get_supplier_group_details(self):
|
def test_get_supplier_group_details(self):
|
||||||
doc = frappe.get_doc("Supplier Group", "Local")
|
doc = frappe.new_doc("Supplier Group")
|
||||||
|
doc.supplier_group_name = "_Testing Supplier Group"
|
||||||
doc.payment_terms = "_Test Payment Term Template 3"
|
doc.payment_terms = "_Test Payment Term Template 3"
|
||||||
doc.accounts = []
|
doc.accounts = []
|
||||||
test_account_details = {
|
test_account_details = {
|
||||||
@ -23,15 +24,18 @@ class TestSupplier(unittest.TestCase):
|
|||||||
}
|
}
|
||||||
doc.append("accounts", test_account_details)
|
doc.append("accounts", test_account_details)
|
||||||
doc.save()
|
doc.save()
|
||||||
doc = frappe.get_doc("Supplier", "_Test Supplier")
|
s_doc = frappe.new_doc("Supplier")
|
||||||
doc.supplier_group = "Local"
|
s_doc.supplier_name = "Testing Supplier"
|
||||||
doc.payment_terms = ""
|
s_doc.supplier_group = "_Testing Supplier Group"
|
||||||
doc.accounts = []
|
s_doc.payment_terms = ""
|
||||||
doc.save()
|
s_doc.accounts = []
|
||||||
doc.get_supplier_group_details()
|
s_doc.insert()
|
||||||
self.assertEqual(doc.payment_terms, "_Test Payment Term Template 3")
|
s_doc.get_supplier_group_details()
|
||||||
self.assertEqual(doc.accounts[0].company, "_Test Company")
|
self.assertEqual(s_doc.payment_terms, "_Test Payment Term Template 3")
|
||||||
self.assertEqual(doc.accounts[0].account, "Creditors - _TC")
|
self.assertEqual(s_doc.accounts[0].company, "_Test Company")
|
||||||
|
self.assertEqual(s_doc.accounts[0].account, "Creditors - _TC")
|
||||||
|
s_doc.delete()
|
||||||
|
doc.delete()
|
||||||
|
|
||||||
def test_supplier_default_payment_terms(self):
|
def test_supplier_default_payment_terms(self):
|
||||||
# Payment Term based on Days after invoice date
|
# Payment Term based on Days after invoice date
|
||||||
|
@ -28,7 +28,8 @@ class TestCustomer(unittest.TestCase):
|
|||||||
set_credit_limit('_Test Customer', '_Test Company', 0)
|
set_credit_limit('_Test Customer', '_Test Company', 0)
|
||||||
|
|
||||||
def test_get_customer_group_details(self):
|
def test_get_customer_group_details(self):
|
||||||
doc = frappe.get_doc("Customer Group", "Commercial")
|
doc = frappe.new_doc("Customer Group")
|
||||||
|
doc.customer_group_name = "_Testing Customer Group"
|
||||||
doc.payment_terms = "_Test Payment Term Template 3"
|
doc.payment_terms = "_Test Payment Term Template 3"
|
||||||
doc.accounts = []
|
doc.accounts = []
|
||||||
doc.default_price_list = "Standard Buying"
|
doc.default_price_list = "Standard Buying"
|
||||||
@ -43,21 +44,24 @@ class TestCustomer(unittest.TestCase):
|
|||||||
}
|
}
|
||||||
doc.append("accounts", test_account_details)
|
doc.append("accounts", test_account_details)
|
||||||
doc.append("credit_limits", test_credit_limits)
|
doc.append("credit_limits", test_credit_limits)
|
||||||
doc.save()
|
doc.insert()
|
||||||
|
|
||||||
doc = frappe.get_doc("Customer", "_Test Customer")
|
c_doc = frappe.new_doc("Customer")
|
||||||
doc.customer_group = "Commercial"
|
c_doc.customer_name = "Testing Customer"
|
||||||
doc.payment_terms = doc.default_price_list = ""
|
c_doc.customer_group = "_Testing Customer Group"
|
||||||
doc.accounts = doc.credit_limits= []
|
c_doc.payment_terms = c_doc.default_price_list = ""
|
||||||
doc.save()
|
c_doc.accounts = c_doc.credit_limits= []
|
||||||
doc.get_customer_group_details()
|
c_doc.insert()
|
||||||
self.assertEqual(doc.payment_terms, "_Test Payment Term Template 3")
|
c_doc.get_customer_group_details()
|
||||||
|
self.assertEqual(c_doc.payment_terms, "_Test Payment Term Template 3")
|
||||||
|
|
||||||
self.assertEqual(doc.accounts[0].company, "_Test Company")
|
self.assertEqual(c_doc.accounts[0].company, "_Test Company")
|
||||||
self.assertEqual(doc.accounts[0].account, "Creditors - _TC")
|
self.assertEqual(c_doc.accounts[0].account, "Creditors - _TC")
|
||||||
|
|
||||||
self.assertEqual(doc.credit_limits[0].company, "_Test Company")
|
self.assertEqual(c_doc.credit_limits[0].company, "_Test Company")
|
||||||
self.assertEqual(doc.credit_limits[0].credit_limit, 350000 )
|
self.assertEqual(c_doc.credit_limits[0].credit_limit, 350000)
|
||||||
|
c_doc.delete()
|
||||||
|
doc.delete()
|
||||||
|
|
||||||
def test_party_details(self):
|
def test_party_details(self):
|
||||||
from erpnext.accounts.party import get_party_details
|
from erpnext.accounts.party import get_party_details
|
||||||
|
Loading…
Reference in New Issue
Block a user