refactor(test): remove AccountsTestMixin from reactivity

This commit is contained in:
ruthra kumar
2026-03-27 11:56:52 +05:30
parent 0b6546ea06
commit d2ee967383
2 changed files with 9 additions and 47 deletions

View File

@@ -229,23 +229,3 @@ class AccountsTestMixin:
] ]
for doctype in doctype_list: for doctype in doctype_list:
qb.from_(qb.DocType(doctype)).delete().where(qb.DocType(doctype).company == self.company).run() qb.from_(qb.DocType(doctype)).delete().where(qb.DocType(doctype).company == self.company).run()
def create_price_list(self):
pl_name = "Mixin Price List"
if not frappe.db.exists("Price List", pl_name):
self.price_list = (
frappe.get_doc(
{
"doctype": "Price List",
"currency": "INR",
"enabled": True,
"selling": True,
"buying": True,
"price_list_name": pl_name,
}
)
.insert()
.name
)
else:
self.price_list = frappe.get_doc("Price List", pl_name).name

View File

@@ -2,35 +2,17 @@ import frappe
from frappe import qb from frappe import qb
from frappe.utils import today from frappe.utils import today
from erpnext.accounts.test.accounts_mixin import AccountsTestMixin
from erpnext.tests.utils import ERPNextTestSuite from erpnext.tests.utils import ERPNextTestSuite
class TestReactivity(ERPNextTestSuite, AccountsTestMixin): class TestReactivity(ERPNextTestSuite):
def setUp(self):
self.create_company()
self.create_customer()
self.create_item()
self.create_usd_receivable_account()
self.create_price_list()
self.clear_old_entries()
def disable_dimensions(self):
res = frappe.db.get_all("Accounting Dimension", filters={"disabled": False})
for x in res:
dim = frappe.get_doc("Accounting Dimension", x.name)
dim.disabled = True
dim.save()
def test_01_basic_item_details(self): def test_01_basic_item_details(self):
self.disable_dimensions()
# set Item Price # set Item Price
frappe.get_doc( frappe.get_doc(
{ {
"doctype": "Item Price", "doctype": "Item Price",
"item_code": self.item, "item_code": "_Test Item",
"price_list": self.price_list, "price_list": "Standard Selling",
"price_list_rate": 90, "price_list_rate": 90,
"selling": True, "selling": True,
"rate": 90, "rate": 90,
@@ -41,18 +23,18 @@ class TestReactivity(ERPNextTestSuite, AccountsTestMixin):
si = frappe.get_doc( si = frappe.get_doc(
{ {
"doctype": "Sales Invoice", "doctype": "Sales Invoice",
"company": self.company, "company": "_Test Company",
"customer": self.customer, "customer": "_Test Customer",
"debit_to": self.debit_to, "debit_to": "Debtors - _TC",
"posting_date": today(), "posting_date": today(),
"cost_center": self.cost_center, "cost_center": "Main - _TC",
"currency": "INR", "currency": "INR",
"conversion_rate": 1, "conversion_rate": 1,
"selling_price_list": self.price_list, "selling_price_list": "Standard Selling",
} }
) )
itm = si.append("items") itm = si.append("items")
itm.item_code = self.item itm.item_code = "_Test Item"
si.process_item_selection(itm.idx) si.process_item_selection(itm.idx)
self.assertEqual(itm.rate, 90) self.assertEqual(itm.rate, 90)