test: updated test cases

This commit is contained in:
Noah Jacob
2021-07-02 19:35:50 +05:30
parent 872cd1cac8
commit e60a349432
2 changed files with 31 additions and 23 deletions

View File

@@ -14,7 +14,8 @@ test_records = frappe.get_test_records('Supplier')
class TestSupplier(unittest.TestCase):
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.accounts = []
test_account_details = {
@@ -23,15 +24,18 @@ class TestSupplier(unittest.TestCase):
}
doc.append("accounts", test_account_details)
doc.save()
doc = frappe.get_doc("Supplier", "_Test Supplier")
doc.supplier_group = "Local"
doc.payment_terms = ""
doc.accounts = []
doc.save()
doc.get_supplier_group_details()
self.assertEqual(doc.payment_terms, "_Test Payment Term Template 3")
self.assertEqual(doc.accounts[0].company, "_Test Company")
self.assertEqual(doc.accounts[0].account, "Creditors - _TC")
s_doc = frappe.new_doc("Supplier")
s_doc.supplier_name = "Testing Supplier"
s_doc.supplier_group = "_Testing Supplier Group"
s_doc.payment_terms = ""
s_doc.accounts = []
s_doc.insert()
s_doc.get_supplier_group_details()
self.assertEqual(s_doc.payment_terms, "_Test Payment Term Template 3")
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):
# Payment Term based on Days after invoice date