From 9a0907131a493828221b701923e12b8f03d278a0 Mon Sep 17 00:00:00 2001 From: Sagar Vora Date: Mon, 5 Apr 2021 14:50:09 +0530 Subject: [PATCH] test: create tax rule if it doesnt exist (#25199) --- erpnext/shopping_cart/test_shopping_cart.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/erpnext/shopping_cart/test_shopping_cart.py b/erpnext/shopping_cart/test_shopping_cart.py index cf59a52b5b..470a402a4a 100644 --- a/erpnext/shopping_cart/test_shopping_cart.py +++ b/erpnext/shopping_cart/test_shopping_cart.py @@ -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")