test: create tax rule if it doesnt exist (#25199)

This commit is contained in:
Sagar Vora 2021-04-05 14:50:09 +05:30 committed by GitHub
parent 8789ef16a1
commit 9a0907131a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,6 +16,11 @@ class TestShoppingCart(unittest.TestCase):
Note:
Shopping Cart == Quotation
"""
@classmethod
def tearDownClass(cls):
frappe.db.sql("delete from `tabTax Rule`")
def setUp(self):
frappe.set_user("Administrator")
create_test_contact_and_address()
@ -100,6 +105,7 @@ class TestShoppingCart(unittest.TestCase):
self.assertEqual(len(quotation.get("items")), 1)
def test_tax_rule(self):
self.create_tax_rule()
self.login_as_customer()
quotation = self.create_quotation()
@ -115,6 +121,13 @@ class TestShoppingCart(unittest.TestCase):
self.remove_test_quotation(quotation)
def create_tax_rule(self):
tax_rule = frappe.get_test_records("Tax Rule")[0]
try:
frappe.get_doc(tax_rule).insert()
except frappe.DuplicateEntryError:
pass
def create_quotation(self):
quotation = frappe.new_doc("Quotation")