refactor(test): make customer deterministic

This commit is contained in:
ruthra kumar
2026-02-17 17:59:22 +05:30
parent cb693e05bf
commit 7fea5a5ca2

View File

@@ -89,14 +89,11 @@ class TestCustomer(ERPNextTestSuite):
def test_party_details_tax_category(self):
from erpnext.accounts.party import get_party_details
frappe.delete_doc_if_exists("Address", "_Test Address With Tax Category-Billing")
frappe.delete_doc_if_exists("Address", "_Test Address With Tax Category-Shipping")
# Tax Category without Address
details = get_party_details("_Test Customer With Tax Category")
self.assertEqual(details.tax_category, "_Test Tax Category 1")
billing_address = frappe.get_doc(
frappe.get_doc(
doctype="Address",
address_title="_Test Address With Tax Category",
tax_category="_Test Tax Category 2",
@@ -104,9 +101,10 @@ class TestCustomer(ERPNextTestSuite):
address_line1="Station Road",
city="_Test City",
country="India",
is_primary_address=True,
links=[dict(link_doctype="Customer", link_name="_Test Customer With Tax Category")],
).insert()
shipping_address = frappe.get_doc(
frappe.get_doc(
doctype="Address",
address_title="_Test Address With Tax Category",
tax_category="_Test Tax Category 3",
@@ -114,6 +112,7 @@ class TestCustomer(ERPNextTestSuite):
address_line1="Station Road",
city="_Test City",
country="India",
is_shipping_address=True,
links=[dict(link_doctype="Customer", link_name="_Test Customer With Tax Category")],
).insert()
@@ -135,8 +134,6 @@ class TestCustomer(ERPNextTestSuite):
# Rollback
settings.determine_address_tax_category_from = rollback_setting
settings.save()
billing_address.delete()
shipping_address.delete()
def test_rename(self):
# delete communication linked to these 2 customers