Added test for Tax Rule based on Tax Category

This commit is contained in:
Saif Ur Rehman 2019-01-07 00:37:01 +05:00
parent 13a6c0aeff
commit f484f0d6e8
3 changed files with 31 additions and 1 deletions

View File

@ -11,4 +11,4 @@
}
]
}
]
]

View File

@ -0,0 +1,10 @@
[
{
"doctype": "Tax Category",
"title": "_Test Tax Category 1"
},
{
"doctype": "Tax Category",
"title": "_Test Tax Category 2"
}
]

View File

@ -74,6 +74,26 @@ class TestTaxRule(unittest.TestCase):
self.assertEqual(get_tax_template("2015-01-01", {"customer":"_Test Customer 2"}),
"_Test Sales Taxes and Charges Template 2 - _TC")
def test_select_tax_rule_based_on_tax_category(self):
make_tax_rule(customer="_Test Customer", tax_category="_Test Tax Category 1",
sales_tax_template="_Test Sales Taxes and Charges Template 1 - _TC", save=1)
make_tax_rule(customer="_Test Customer", tax_category="_Test Tax Category 2",
sales_tax_template="_Test Sales Taxes and Charges Template 2 - _TC", save=1)
self.assertFalse(get_tax_template("2015-01-01", {"customer": "_Test Customer"}))
self.assertEqual(get_tax_template("2015-01-01", {"customer": "_Test Customer", "tax_category": "_Test Tax Category 1"}),
"_Test Sales Taxes and Charges Template 1 - _TC")
self.assertEqual(get_tax_template("2015-01-01", {"customer": "_Test Customer", "tax_category": "_Test Tax Category 2"}),
"_Test Sales Taxes and Charges Template 2 - _TC")
make_tax_rule(customer="_Test Customer", tax_category="",
sales_tax_template="_Test Sales Taxes and Charges Template - _TC", save=1)
self.assertEqual(get_tax_template("2015-01-01", {"customer": "_Test Customer"}),
"_Test Sales Taxes and Charges Template - _TC")
def test_select_tax_rule_based_on_better_match(self):
make_tax_rule(customer= "_Test Customer", billing_city = "Test City", billing_state = "Test State",
sales_tax_template = "_Test Sales Taxes and Charges Template - _TC", save=1)