From 743ba690dda5c227f48eaf4b1f42599adb0b350b Mon Sep 17 00:00:00 2001 From: tunde Date: Tue, 5 Sep 2017 01:17:14 +0100 Subject: [PATCH] more test cases for Supplier --- .../buying/doctype/supplier/test_supplier.py | 31 ++++++++----------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/erpnext/buying/doctype/supplier/test_supplier.py b/erpnext/buying/doctype/supplier/test_supplier.py index 2af6759260..c52b9a0d5c 100644 --- a/erpnext/buying/doctype/supplier/test_supplier.py +++ b/erpnext/buying/doctype/supplier/test_supplier.py @@ -38,25 +38,20 @@ class TestSupplier(unittest.TestCase): frappe.db.set_value("Supplier", "_Test Supplier With Template 1", "payment_terms", "") # Set credit limit for the supplier type instead of supplier and evaluate the due date - # frappe.db.set_value("Supplier Type", "_Test Supplier Type", "credit_days_based_on", - # "Fixed Days") - # frappe.db.set_value("Supplier Type", "_Test Supplier Type", "credit_days", 10) - # - # due_date = get_due_date("2016-01-22", "Supplier", "_Test Supplier", "_Test Company") - # self.assertEqual(due_date, "2016-02-01") - # - # # Set credit limit for the supplier type instead of supplier and evaluate the due date - # # based on Last day of next month - # frappe.db.set_value("Supplier", "_Test Supplier Type", "credit_days", 0) - # frappe.db.set_value("Supplier Type", "_Test Supplier Type", "credit_days_based_on", - # "Last Day of the Next Month") - # - # # Leap year - # due_date = get_due_date("2016-01-22", "Supplier", "_Test Supplier", "_Test Company") - # self.assertEqual(due_date, "2016-02-29") + frappe.db.set_value("Supplier Type", "_Test Supplier Type", "payment_terms", "_Test Payment Term Template 3") + + due_date = get_due_date("2016-01-22", "Supplier", "_Test Supplier With Template 1") + self.assertEqual(due_date, "2016-02-21") + + # Set credit limit for the supplier type instead of supplier and evaluate the due date + frappe.db.set_value("Supplier Type", "_Test Supplier Type", "payment_terms", "_Test Payment Term Template 1") + + # Leap year + due_date = get_due_date("2016-01-22", "Supplier", "_Test Supplier With Template 1") + self.assertEqual(due_date, "2016-02-29") # # Non Leap year - # due_date = get_due_date("2017-01-22", "Supplier", "_Test Supplier", "_Test Company") - # self.assertEqual(due_date, "2017-02-28") + due_date = get_due_date("2017-01-22", "Supplier", "_Test Supplier With Template 1") + self.assertEqual(due_date, "2017-02-28") def test_supplier_disabled(self): make_test_records("Item")