add tests for payment term template

This commit is contained in:
tunde 2017-09-22 16:04:07 +01:00
parent d6cf6fb124
commit e6b3fe1215

View File

@ -4,6 +4,46 @@
from __future__ import unicode_literals
import unittest
import frappe
class TestPaymentTermsTemplate(unittest.TestCase):
pass
def tearDown(self):
frappe.delete_doc('Payment Terms Template', '_Test Payment Terms Template', force=1)
def test_create_template(self):
template = frappe.get_doc({
'doctype': 'Payment Terms Template',
'template_name': '_Test Payment Terms Template',
'terms': [{
'doctype': 'Payment Terms Template Detail',
'invoice_portion': 50.00,
'credit_days_based_on': 'Day(s) after invoice date',
'credit_days': 30
}]
})
self.assertRaises(frappe.ValidationError, template.insert)
template.append('terms', {
'doctype': 'Payment Terms Template Detail',
'invoice_portion': 50.00,
'credit_days_based_on': 'Day(s) after invoice date',
'credit_days': 0
})
template.insert()
def test_credit_days(self):
template = frappe.get_doc({
'doctype': 'Payment Terms Template',
'template_name': '_Test Payment Terms Template',
'terms': [{
'doctype': 'Payment Terms Template Detail',
'invoice_portion': 100.00,
'credit_days_based_on': 'Day(s) after invoice date',
'credit_days': -30
}]
})
self.assertRaises(frappe.ValidationError, template.insert)