mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-13 11:55:11 +00:00
test: don't delete global test records (it's forbidden)
This commit is contained in:
@@ -26,9 +26,6 @@ class TestBankClearance(IntegrationTestCase):
|
||||
create_item("_Test Item")
|
||||
create_cost_center(cost_center_name="_Test Cost Center", company="_Test Company")
|
||||
|
||||
clear_payment_entries()
|
||||
clear_loan_transactions()
|
||||
clear_pos_sales_invoices()
|
||||
make_bank_account()
|
||||
add_transactions()
|
||||
|
||||
@@ -123,23 +120,6 @@ class TestBankClearance(IntegrationTestCase):
|
||||
self.assertEqual(si_clearance_date, date)
|
||||
|
||||
|
||||
def clear_payment_entries():
|
||||
frappe.db.delete("Payment Entry")
|
||||
|
||||
|
||||
def clear_pos_sales_invoices():
|
||||
frappe.db.delete("Sales Invoice", {"is_pos": 1})
|
||||
|
||||
|
||||
@if_lending_app_installed
|
||||
def clear_loan_transactions():
|
||||
for dt in [
|
||||
"Loan Disbursement",
|
||||
"Loan Repayment",
|
||||
]:
|
||||
frappe.db.delete(dt)
|
||||
|
||||
|
||||
def make_bank_account():
|
||||
if not frappe.db.get_value("Account", "_Test Bank Clearance - _TC"):
|
||||
frappe.get_doc(
|
||||
|
||||
@@ -32,14 +32,6 @@ class UnitTestBankTransaction(UnitTestCase):
|
||||
|
||||
class TestBankTransaction(IntegrationTestCase):
|
||||
def setUp(self):
|
||||
for dt in [
|
||||
"Bank Transaction",
|
||||
"Payment Entry",
|
||||
"Payment Entry Reference",
|
||||
"POS Profile",
|
||||
]:
|
||||
frappe.db.delete(dt)
|
||||
clear_loan_transactions()
|
||||
make_pos_profile()
|
||||
|
||||
# generate and use a uniq hash identifier for 'Bank Account' and it's linked GL 'Account' to avoid validation error
|
||||
@@ -231,11 +223,6 @@ class TestBankTransaction(IntegrationTestCase):
|
||||
self.assertEqual(linked_payments[0]["name"], repayment_entry.name)
|
||||
|
||||
|
||||
@if_lending_app_installed
|
||||
def clear_loan_transactions():
|
||||
frappe.db.delete("Loan Repayment")
|
||||
|
||||
|
||||
def create_bank_account(
|
||||
bank_name="Citi Bank", gl_account="_Test Bank - _TC", bank_account_name="Checking Account"
|
||||
):
|
||||
|
||||
@@ -11,15 +11,6 @@ from erpnext.tests.utils import if_lending_app_installed
|
||||
|
||||
|
||||
class TestBankReconciliationStatement(IntegrationTestCase):
|
||||
def setUp(self):
|
||||
for dt in [
|
||||
"Journal Entry",
|
||||
"Journal Entry Account",
|
||||
"Payment Entry",
|
||||
]:
|
||||
frappe.db.delete(dt)
|
||||
clear_loan_transactions()
|
||||
|
||||
@if_lending_app_installed
|
||||
def test_loan_entries_in_bank_reco_statement(self):
|
||||
from lending.loan_management.doctype.loan.test_loan import create_loan_accounts
|
||||
@@ -42,12 +33,3 @@ class TestBankReconciliationStatement(IntegrationTestCase):
|
||||
result = execute(filters)
|
||||
|
||||
self.assertEqual(result[1][0].payment_entry, repayment_entry.name)
|
||||
|
||||
|
||||
@if_lending_app_installed
|
||||
def clear_loan_transactions():
|
||||
for dt in [
|
||||
"Loan Disbursement",
|
||||
"Loan Repayment",
|
||||
]:
|
||||
frappe.db.delete(dt)
|
||||
|
||||
@@ -16,7 +16,6 @@ from erpnext.crm.report.sales_pipeline_analytics.test_sales_pipeline_analytics i
|
||||
class TestOpportunitySummaryBySalesStage(IntegrationTestCase):
|
||||
@classmethod
|
||||
def setUpClass(self):
|
||||
frappe.db.delete("Opportunity")
|
||||
create_company()
|
||||
create_customer()
|
||||
create_opportunity()
|
||||
|
||||
@@ -8,7 +8,6 @@ from erpnext.crm.report.sales_pipeline_analytics.sales_pipeline_analytics import
|
||||
|
||||
class TestSalesPipelineAnalytics(IntegrationTestCase):
|
||||
def setUp(self):
|
||||
frappe.db.delete("Opportunity")
|
||||
create_company()
|
||||
create_customer()
|
||||
create_opportunity()
|
||||
|
||||
@@ -21,16 +21,9 @@ EXTRA_TEST_RECORD_DEPENDENCIES = [
|
||||
|
||||
|
||||
class TestPaymentTermsStatusForSalesOrder(IntegrationTestCase):
|
||||
def setUp(self):
|
||||
self.cleanup_old_entries()
|
||||
|
||||
def tearDown(self):
|
||||
frappe.db.rollback()
|
||||
|
||||
def cleanup_old_entries(self):
|
||||
frappe.db.delete("Sales Invoice", filters={"company": "_Test Company"})
|
||||
frappe.db.delete("Sales Order", filters={"company": "_Test Company"})
|
||||
|
||||
def create_payment_terms_template(self):
|
||||
# create template for 50-50 payments
|
||||
template = None
|
||||
|
||||
@@ -36,8 +36,6 @@ def before_tests():
|
||||
}
|
||||
)
|
||||
|
||||
frappe.db.sql("delete from `tabItem Price`")
|
||||
|
||||
_enable_all_roles_for_admin()
|
||||
|
||||
set_defaults_for_tests()
|
||||
|
||||
Reference in New Issue
Block a user