From e75eebc7a0f217ee11e6d7af8f45ffaf1efad260 Mon Sep 17 00:00:00 2001 From: David Date: Tue, 8 Oct 2024 00:42:00 +0200 Subject: [PATCH] refactor: Use IntegrationTestCase in multiple files Signed-off-by: David --- .../bank_statement_import/test_bank_statement_import.py | 5 +++-- erpnext/accounts/doctype/budget/test_budget.py | 4 ++-- .../doctype/cashier_closing/test_cashier_closing.py | 5 +++-- .../test_chart_of_accounts_importer.py | 5 +++-- .../cheque_print_template/test_cheque_print_template.py | 5 +++-- erpnext/accounts/doctype/cost_center/test_cost_center.py | 4 ++-- .../cost_center_allocation/test_cost_center_allocation.py | 4 ++-- erpnext/accounts/doctype/coupon_code/test_coupon_code.py | 4 ++-- .../test_currency_exchange_settings.py | 5 +++-- .../accounts/doctype/dunning_type/test_dunning_type.py | 5 +++-- .../accounts/doctype/finance_book/test_finance_book.py | 4 ++-- erpnext/accounts/doctype/fiscal_year/test_fiscal_year.py | 5 ++--- erpnext/accounts/doctype/gl_entry/test_gl_entry.py | 5 ++--- .../invoice_discounting/test_invoice_discounting.py | 4 ++-- .../doctype/item_tax_template/test_item_tax_template.py | 5 +++-- .../journal_entry_template/test_journal_entry_template.py | 5 +++-- .../accounts/doctype/ledger_merge/test_ledger_merge.py | 4 ++-- .../loyalty_point_entry/test_loyalty_point_entry.py | 4 ++-- .../doctype/loyalty_program/test_loyalty_program.py | 4 ++-- .../doctype/mode_of_payment/test_mode_of_payment.py | 5 +++-- .../monthly_distribution/test_monthly_distribution.py | 5 ++--- erpnext/accounts/doctype/party_link/test_party_link.py | 5 +++-- .../test_payment_gateway_account.py | 5 +++-- .../accounts/doctype/payment_term/test_payment_term.py | 5 +++-- .../payment_terms_template/test_payment_terms_template.py | 4 ++-- .../period_closing_voucher/test_period_closing_voucher.py | 5 ++--- .../doctype/pos_closing_entry/test_pos_closing_entry.py | 4 ++-- erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py | 4 ++-- .../pos_invoice_merge_log/test_pos_invoice_merge_log.py | 1 - .../doctype/pos_opening_entry/test_pos_opening_entry.py | 4 ++-- erpnext/accounts/doctype/pos_profile/test_pos_profile.py | 8 ++++---- .../doctype/pos_profile_user/test_pos_profile_user.py | 5 +++-- .../accounts/doctype/pos_settings/test_pos_settings.py | 5 +++-- .../test_process_deferred_accounting.py | 4 ++-- .../doctype/promotional_scheme/test_promotional_scheme.py | 4 ++-- .../test_purchase_taxes_and_charges_template.py | 5 +++-- .../test_sales_taxes_and_charges_template.py | 4 ++-- .../doctype/share_transfer/test_share_transfer.py | 4 ++-- erpnext/accounts/doctype/share_type/test_share_type.py | 5 +++-- erpnext/accounts/doctype/shareholder/test_shareholder.py | 5 +++-- .../accounts/doctype/shipping_rule/test_shipping_rule.py | 4 ++-- .../subscription_invoice/test_subscription_invoice.py | 5 +++-- .../doctype/subscription_plan/test_subscription_plan.py | 5 +++-- .../subscription_settings/test_subscription_settings.py | 5 +++-- .../accounts/doctype/tax_category/test_tax_category.py | 5 +++-- erpnext/accounts/doctype/tax_rule/test_tax_rule.py | 4 ++-- .../report/account_balance/test_account_balance.py | 3 ++- .../sales_payment_summary/test_sales_payment_summary.py | 5 ++--- erpnext/accounts/test/test_reports.py | 4 +++- erpnext/accounts/test/test_utils.py | 3 ++- erpnext/assets/doctype/asset/test_asset.py | 4 ++-- .../asset_capitalization/test_asset_capitalization.py | 4 ++-- .../assets/doctype/asset_category/test_asset_category.py | 4 ++-- .../doctype/asset_maintenance/test_asset_maintenance.py | 4 ++-- .../asset_maintenance_log/test_asset_maintenance_log.py | 5 +++-- .../asset_maintenance_team/test_asset_maintenance_team.py | 5 +++-- .../assets/doctype/asset_movement/test_asset_movement.py | 4 ++-- erpnext/assets/doctype/asset_repair/test_asset_repair.py | 4 ++-- .../asset_value_adjustment/test_asset_value_adjustment.py | 4 ++-- erpnext/assets/doctype/location/test_location.py | 4 ++-- .../test_maintenance_team_member.py | 5 +++-- .../doctype/buying_settings/test_buying_settings.py | 5 +++-- .../test_supplier_scorecard_period.py | 5 +++-- .../test_supplier_scorecard_standing.py | 5 +++-- erpnext/controllers/tests/test_item_variant.py | 3 ++- erpnext/controllers/tests/test_mapper.py | 3 ++- erpnext/controllers/tests/test_qty_based_taxes.py | 3 ++- erpnext/controllers/tests/test_queries.py | 3 ++- erpnext/controllers/tests/test_transaction_base.py | 3 ++- erpnext/crm/doctype/appointment/test_appointment.py | 4 ++-- .../test_appointment_booking_settings.py | 5 +++-- erpnext/crm/doctype/campaign/test_campaign.py | 5 +++-- erpnext/crm/doctype/competitor/test_competitor.py | 5 +++-- erpnext/crm/doctype/contract/test_contract.py | 4 ++-- .../test_contract_fulfilment_checklist.py | 5 +++-- .../doctype/contract_template/test_contract_template.py | 5 +++-- erpnext/crm/doctype/crm_settings/test_crm_settings.py | 5 +++-- erpnext/crm/doctype/email_campaign/test_email_campaign.py | 5 +++-- erpnext/crm/doctype/lead/test_lead.py | 5 ++--- erpnext/crm/doctype/market_segment/test_market_segment.py | 5 +++-- erpnext/crm/doctype/opportunity/test_opportunity.py | 4 ++-- .../crm/doctype/opportunity_type/test_opportunity_type.py | 5 +++-- erpnext/crm/doctype/prospect/test_prospect.py | 4 ++-- erpnext/crm/doctype/sales_stage/test_sales_stage.py | 5 +++-- .../test_opportunity_summary_by_sales_stage.py | 3 ++- 85 files changed, 208 insertions(+), 168 deletions(-) diff --git a/erpnext/accounts/doctype/bank_statement_import/test_bank_statement_import.py b/erpnext/accounts/doctype/bank_statement_import/test_bank_statement_import.py index 08c12bddb0b..0dc1093fe1e 100644 --- a/erpnext/accounts/doctype/bank_statement_import/test_bank_statement_import.py +++ b/erpnext/accounts/doctype/bank_statement_import/test_bank_statement_import.py @@ -1,9 +1,10 @@ # Copyright (c) 2020, Frappe Technologies and Contributors # See license.txt - # import frappe import unittest +from frappe.tests import IntegrationTestCase -class TestBankStatementImport(unittest.TestCase): + +class TestBankStatementImport(IntegrationTestCase): pass diff --git a/erpnext/accounts/doctype/budget/test_budget.py b/erpnext/accounts/doctype/budget/test_budget.py index 6d9a6f51468..beb9e172c6e 100644 --- a/erpnext/accounts/doctype/budget/test_budget.py +++ b/erpnext/accounts/doctype/budget/test_budget.py @@ -1,9 +1,9 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase from frappe.utils import now_datetime, nowdate from erpnext.accounts.doctype.budget.budget import BudgetError, get_actual_expense @@ -14,7 +14,7 @@ from erpnext.buying.doctype.purchase_order.test_purchase_order import create_pur test_dependencies = ["Monthly Distribution"] -class TestBudget(unittest.TestCase): +class TestBudget(IntegrationTestCase): def test_monthly_budget_crossed_ignore(self): set_total_expense_zero(nowdate(), "cost_center") diff --git a/erpnext/accounts/doctype/cashier_closing/test_cashier_closing.py b/erpnext/accounts/doctype/cashier_closing/test_cashier_closing.py index d11737c33cc..56cf2b53919 100644 --- a/erpnext/accounts/doctype/cashier_closing/test_cashier_closing.py +++ b/erpnext/accounts/doctype/cashier_closing/test_cashier_closing.py @@ -1,8 +1,9 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest +from frappe.tests import IntegrationTestCase -class TestCashierClosing(unittest.TestCase): + +class TestCashierClosing(IntegrationTestCase): pass diff --git a/erpnext/accounts/doctype/chart_of_accounts_importer/test_chart_of_accounts_importer.py b/erpnext/accounts/doctype/chart_of_accounts_importer/test_chart_of_accounts_importer.py index 00e5cc30671..214de348169 100644 --- a/erpnext/accounts/doctype/chart_of_accounts_importer/test_chart_of_accounts_importer.py +++ b/erpnext/accounts/doctype/chart_of_accounts_importer/test_chart_of_accounts_importer.py @@ -1,8 +1,9 @@ # Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest +from frappe.tests import IntegrationTestCase -class TestChartofAccountsImporter(unittest.TestCase): + +class TestChartofAccountsImporter(IntegrationTestCase): pass diff --git a/erpnext/accounts/doctype/cheque_print_template/test_cheque_print_template.py b/erpnext/accounts/doctype/cheque_print_template/test_cheque_print_template.py index 9b003ceaa3e..347d5eda456 100644 --- a/erpnext/accounts/doctype/cheque_print_template/test_cheque_print_template.py +++ b/erpnext/accounts/doctype/cheque_print_template/test_cheque_print_template.py @@ -1,10 +1,11 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest +from frappe.tests import IntegrationTestCase + # test_records = frappe.get_test_records('Cheque Print Template') -class TestChequePrintTemplate(unittest.TestCase): +class TestChequePrintTemplate(IntegrationTestCase): pass diff --git a/erpnext/accounts/doctype/cost_center/test_cost_center.py b/erpnext/accounts/doctype/cost_center/test_cost_center.py index 7d01918fb54..f975520787d 100644 --- a/erpnext/accounts/doctype/cost_center/test_cost_center.py +++ b/erpnext/accounts/doctype/cost_center/test_cost_center.py @@ -1,14 +1,14 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase test_records = frappe.get_test_records("Cost Center") -class TestCostCenter(unittest.TestCase): +class TestCostCenter(IntegrationTestCase): def test_cost_center_creation_against_child_node(self): if not frappe.db.get_value("Cost Center", {"name": "_Test Cost Center 2 - _TC"}): frappe.get_doc(test_records[1]).insert() diff --git a/erpnext/accounts/doctype/cost_center_allocation/test_cost_center_allocation.py b/erpnext/accounts/doctype/cost_center_allocation/test_cost_center_allocation.py index 4abc82d8bec..41fb5fe3b92 100644 --- a/erpnext/accounts/doctype/cost_center_allocation/test_cost_center_allocation.py +++ b/erpnext/accounts/doctype/cost_center_allocation/test_cost_center_allocation.py @@ -1,9 +1,9 @@ # Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase from frappe.utils import add_days, today from erpnext.accounts.doctype.cost_center.test_cost_center import create_cost_center @@ -17,7 +17,7 @@ from erpnext.accounts.doctype.cost_center_allocation.cost_center_allocation impo from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry -class TestCostCenterAllocation(unittest.TestCase): +class TestCostCenterAllocation(IntegrationTestCase): def setUp(self): cost_centers = [ "Main Cost Center 1", diff --git a/erpnext/accounts/doctype/coupon_code/test_coupon_code.py b/erpnext/accounts/doctype/coupon_code/test_coupon_code.py index 293e3d2aa4b..09b26524cbc 100644 --- a/erpnext/accounts/doctype/coupon_code/test_coupon_code.py +++ b/erpnext/accounts/doctype/coupon_code/test_coupon_code.py @@ -1,9 +1,9 @@ # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order @@ -110,7 +110,7 @@ def test_create_test_data(): coupon_code.insert() -class TestCouponCode(unittest.TestCase): +class TestCouponCode(IntegrationTestCase): def setUp(self): test_create_test_data() diff --git a/erpnext/accounts/doctype/currency_exchange_settings/test_currency_exchange_settings.py b/erpnext/accounts/doctype/currency_exchange_settings/test_currency_exchange_settings.py index 2778729f583..3097f72d628 100644 --- a/erpnext/accounts/doctype/currency_exchange_settings/test_currency_exchange_settings.py +++ b/erpnext/accounts/doctype/currency_exchange_settings/test_currency_exchange_settings.py @@ -1,9 +1,10 @@ # Copyright (c) 2021, Wahni Green Technologies Pvt. Ltd. and contributors # For license information, please see license.txt - # import frappe import unittest +from frappe.tests import IntegrationTestCase -class TestCurrencyExchangeSettings(unittest.TestCase): + +class TestCurrencyExchangeSettings(IntegrationTestCase): pass diff --git a/erpnext/accounts/doctype/dunning_type/test_dunning_type.py b/erpnext/accounts/doctype/dunning_type/test_dunning_type.py index 67b72e4be75..5a95aa68ea9 100644 --- a/erpnext/accounts/doctype/dunning_type/test_dunning_type.py +++ b/erpnext/accounts/doctype/dunning_type/test_dunning_type.py @@ -1,9 +1,10 @@ # Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - # import frappe import unittest +from frappe.tests import IntegrationTestCase -class TestDunningType(unittest.TestCase): + +class TestDunningType(IntegrationTestCase): pass diff --git a/erpnext/accounts/doctype/finance_book/test_finance_book.py b/erpnext/accounts/doctype/finance_book/test_finance_book.py index 42c0e512386..e2c156a1df5 100644 --- a/erpnext/accounts/doctype/finance_book/test_finance_book.py +++ b/erpnext/accounts/doctype/finance_book/test_finance_book.py @@ -1,14 +1,14 @@ # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry -class TestFinanceBook(unittest.TestCase): +class TestFinanceBook(IntegrationTestCase): def test_finance_book(self): finance_book = create_finance_book() diff --git a/erpnext/accounts/doctype/fiscal_year/test_fiscal_year.py b/erpnext/accounts/doctype/fiscal_year/test_fiscal_year.py index 8d437164015..8a59942bd38 100644 --- a/erpnext/accounts/doctype/fiscal_year/test_fiscal_year.py +++ b/erpnext/accounts/doctype/fiscal_year/test_fiscal_year.py @@ -1,16 +1,15 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt - - import unittest import frappe +from frappe.tests import IntegrationTestCase from frappe.utils import now_datetime test_ignore = ["Company"] -class TestFiscalYear(unittest.TestCase): +class TestFiscalYear(IntegrationTestCase): def test_extra_year(self): if frappe.db.exists("Fiscal Year", "_Test Fiscal Year 2000"): frappe.delete_doc("Fiscal Year", "_Test Fiscal Year 2000") diff --git a/erpnext/accounts/doctype/gl_entry/test_gl_entry.py b/erpnext/accounts/doctype/gl_entry/test_gl_entry.py index 3edfd67b005..98befb4974d 100644 --- a/erpnext/accounts/doctype/gl_entry/test_gl_entry.py +++ b/erpnext/accounts/doctype/gl_entry/test_gl_entry.py @@ -1,17 +1,16 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt - - import unittest import frappe from frappe.model.naming import parse_naming_series +from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.gl_entry.gl_entry import rename_gle_sle_docs from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry -class TestGLEntry(unittest.TestCase): +class TestGLEntry(IntegrationTestCase): def test_round_off_entry(self): frappe.db.set_value("Company", "_Test Company", "round_off_account", "_Test Write Off - _TC") frappe.db.set_value("Company", "_Test Company", "round_off_cost_center", "_Test Cost Center - _TC") diff --git a/erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py b/erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py index 01050c058e8..f34e2fd2434 100644 --- a/erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py +++ b/erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py @@ -1,9 +1,9 @@ # Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase from frappe.utils import add_days, flt, nowdate from erpnext.accounts.doctype.account.test_account import create_account @@ -12,7 +12,7 @@ from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sal from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import get_gl_entries -class TestInvoiceDiscounting(unittest.TestCase): +class TestInvoiceDiscounting(IntegrationTestCase): def setUp(self): self.ar_credit = create_account( account_name="_Test Accounts Receivable Credit", diff --git a/erpnext/accounts/doctype/item_tax_template/test_item_tax_template.py b/erpnext/accounts/doctype/item_tax_template/test_item_tax_template.py index e8638bb355d..d5d8701fdc2 100644 --- a/erpnext/accounts/doctype/item_tax_template/test_item_tax_template.py +++ b/erpnext/accounts/doctype/item_tax_template/test_item_tax_template.py @@ -1,8 +1,9 @@ # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest +from frappe.tests import IntegrationTestCase -class TestItemTaxTemplate(unittest.TestCase): + +class TestItemTaxTemplate(IntegrationTestCase): pass diff --git a/erpnext/accounts/doctype/journal_entry_template/test_journal_entry_template.py b/erpnext/accounts/doctype/journal_entry_template/test_journal_entry_template.py index 868a0ee7beb..95a287435ff 100644 --- a/erpnext/accounts/doctype/journal_entry_template/test_journal_entry_template.py +++ b/erpnext/accounts/doctype/journal_entry_template/test_journal_entry_template.py @@ -1,9 +1,10 @@ # Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - # import frappe import unittest +from frappe.tests import IntegrationTestCase -class TestJournalEntryTemplate(unittest.TestCase): + +class TestJournalEntryTemplate(IntegrationTestCase): pass diff --git a/erpnext/accounts/doctype/ledger_merge/test_ledger_merge.py b/erpnext/accounts/doctype/ledger_merge/test_ledger_merge.py index dccd73c62a9..fd5001f97bc 100644 --- a/erpnext/accounts/doctype/ledger_merge/test_ledger_merge.py +++ b/erpnext/accounts/doctype/ledger_merge/test_ledger_merge.py @@ -1,14 +1,14 @@ # Copyright (c) 2021, Wahni Green Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.ledger_merge.ledger_merge import start_merge -class TestLedgerMerge(unittest.TestCase): +class TestLedgerMerge(IntegrationTestCase): def test_merge_success(self): if not frappe.db.exists("Account", "Indirect Expenses - _TC"): acc = frappe.new_doc("Account") diff --git a/erpnext/accounts/doctype/loyalty_point_entry/test_loyalty_point_entry.py b/erpnext/accounts/doctype/loyalty_point_entry/test_loyalty_point_entry.py index 1042c46042d..4b185a45ae0 100644 --- a/erpnext/accounts/doctype/loyalty_point_entry/test_loyalty_point_entry.py +++ b/erpnext/accounts/doctype/loyalty_point_entry/test_loyalty_point_entry.py @@ -1,16 +1,16 @@ # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase from frappe.utils import today from erpnext.accounts.doctype.loyalty_program.test_loyalty_program import create_records from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice -class TestLoyaltyPointEntry(unittest.TestCase): +class TestLoyaltyPointEntry(IntegrationTestCase): @classmethod def setUpClass(cls): # Create test records diff --git a/erpnext/accounts/doctype/loyalty_program/test_loyalty_program.py b/erpnext/accounts/doctype/loyalty_program/test_loyalty_program.py index 322ece836f0..ee44ffcdc13 100644 --- a/erpnext/accounts/doctype/loyalty_program/test_loyalty_program.py +++ b/erpnext/accounts/doctype/loyalty_program/test_loyalty_program.py @@ -1,9 +1,9 @@ # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase from frappe.utils import cint, flt, getdate, today from erpnext.accounts.doctype.loyalty_program.loyalty_program import ( @@ -13,7 +13,7 @@ from erpnext.accounts.doctype.loyalty_program.loyalty_program import ( from erpnext.accounts.party import get_dashboard_info -class TestLoyaltyProgram(unittest.TestCase): +class TestLoyaltyProgram(IntegrationTestCase): @classmethod def setUpClass(self): # create relevant item, customer, loyalty program, etc diff --git a/erpnext/accounts/doctype/mode_of_payment/test_mode_of_payment.py b/erpnext/accounts/doctype/mode_of_payment/test_mode_of_payment.py index 9733fb89e2f..2baa7dc5369 100644 --- a/erpnext/accounts/doctype/mode_of_payment/test_mode_of_payment.py +++ b/erpnext/accounts/doctype/mode_of_payment/test_mode_of_payment.py @@ -1,10 +1,11 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest +from frappe.tests import IntegrationTestCase + # test_records = frappe.get_test_records('Mode of Payment') -class TestModeofPayment(unittest.TestCase): +class TestModeofPayment(IntegrationTestCase): pass diff --git a/erpnext/accounts/doctype/monthly_distribution/test_monthly_distribution.py b/erpnext/accounts/doctype/monthly_distribution/test_monthly_distribution.py index 848b1f9de76..4c197f1885d 100644 --- a/erpnext/accounts/doctype/monthly_distribution/test_monthly_distribution.py +++ b/erpnext/accounts/doctype/monthly_distribution/test_monthly_distribution.py @@ -1,13 +1,12 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and Contributors # See license.txt - - import unittest import frappe +from frappe.tests import IntegrationTestCase test_records = frappe.get_test_records("Monthly Distribution") -class TestMonthlyDistribution(unittest.TestCase): +class TestMonthlyDistribution(IntegrationTestCase): pass diff --git a/erpnext/accounts/doctype/party_link/test_party_link.py b/erpnext/accounts/doctype/party_link/test_party_link.py index 2ae338133e0..1c93c65e3c3 100644 --- a/erpnext/accounts/doctype/party_link/test_party_link.py +++ b/erpnext/accounts/doctype/party_link/test_party_link.py @@ -1,9 +1,10 @@ # Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - # import frappe import unittest +from frappe.tests import IntegrationTestCase -class TestPartyLink(unittest.TestCase): + +class TestPartyLink(IntegrationTestCase): pass diff --git a/erpnext/accounts/doctype/payment_gateway_account/test_payment_gateway_account.py b/erpnext/accounts/doctype/payment_gateway_account/test_payment_gateway_account.py index 6c8f6402fa5..5a6269280a5 100644 --- a/erpnext/accounts/doctype/payment_gateway_account/test_payment_gateway_account.py +++ b/erpnext/accounts/doctype/payment_gateway_account/test_payment_gateway_account.py @@ -1,12 +1,13 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest +from frappe.tests import IntegrationTestCase + # test_records = frappe.get_test_records('Payment Gateway Account') test_ignore = ["Payment Gateway"] -class TestPaymentGatewayAccount(unittest.TestCase): +class TestPaymentGatewayAccount(IntegrationTestCase): pass diff --git a/erpnext/accounts/doctype/payment_term/test_payment_term.py b/erpnext/accounts/doctype/payment_term/test_payment_term.py index 820610c17c2..08f51cfb4e9 100644 --- a/erpnext/accounts/doctype/payment_term/test_payment_term.py +++ b/erpnext/accounts/doctype/payment_term/test_payment_term.py @@ -1,8 +1,9 @@ # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest +from frappe.tests import IntegrationTestCase -class TestPaymentTerm(unittest.TestCase): + +class TestPaymentTerm(IntegrationTestCase): pass diff --git a/erpnext/accounts/doctype/payment_terms_template/test_payment_terms_template.py b/erpnext/accounts/doctype/payment_terms_template/test_payment_terms_template.py index 9717f2009a0..fb0020f78ac 100644 --- a/erpnext/accounts/doctype/payment_terms_template/test_payment_terms_template.py +++ b/erpnext/accounts/doctype/payment_terms_template/test_payment_terms_template.py @@ -1,12 +1,12 @@ # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase -class TestPaymentTermsTemplate(unittest.TestCase): +class TestPaymentTermsTemplate(IntegrationTestCase): def tearDown(self): frappe.delete_doc("Payment Terms Template", "_Test Payment Terms Template For Test", force=1) diff --git a/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py b/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py index 1bd565e1b36..5e6bdc344e5 100644 --- a/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py +++ b/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py @@ -1,10 +1,9 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt - - import unittest import frappe +from frappe.tests import IntegrationTestCase from frappe.utils import today from erpnext.accounts.doctype.finance_book.test_finance_book import create_finance_book @@ -13,7 +12,7 @@ from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sal from erpnext.accounts.utils import get_fiscal_year -class TestPeriodClosingVoucher(unittest.TestCase): +class TestPeriodClosingVoucher(IntegrationTestCase): def test_closing_entry(self): frappe.db.sql("delete from `tabGL Entry` where company='Test PCV Company'") frappe.db.sql("delete from `tabPeriod Closing Voucher` where company='Test PCV Company'") diff --git a/erpnext/accounts/doctype/pos_closing_entry/test_pos_closing_entry.py b/erpnext/accounts/doctype/pos_closing_entry/test_pos_closing_entry.py index e2084e89c43..aaf46b337e9 100644 --- a/erpnext/accounts/doctype/pos_closing_entry/test_pos_closing_entry.py +++ b/erpnext/accounts/doctype/pos_closing_entry/test_pos_closing_entry.py @@ -1,9 +1,9 @@ # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.accounting_dimension.test_accounting_dimension import ( create_dimension, @@ -24,7 +24,7 @@ from erpnext.stock.doctype.serial_and_batch_bundle.test_serial_and_batch_bundle from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry -class TestPOSClosingEntry(unittest.TestCase): +class TestPOSClosingEntry(IntegrationTestCase): def setUp(self): # Make stock available for POS Sales make_stock_entry(target="_Test Warehouse - _TC", qty=2, basic_rate=100) diff --git a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py index 1dbc630e62e..949b825b3f8 100644 --- a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py +++ b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py @@ -1,11 +1,11 @@ # Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import copy import unittest import frappe from frappe import _ +from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.pos_invoice.pos_invoice import make_sales_return from erpnext.accounts.doctype.pos_profile.test_pos_profile import make_pos_profile @@ -20,7 +20,7 @@ from erpnext.stock.doctype.serial_and_batch_bundle.test_serial_and_batch_bundle from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry -class TestPOSInvoice(unittest.TestCase): +class TestPOSInvoice(IntegrationTestCase): @classmethod def setUpClass(cls): make_stock_entry(target="_Test Warehouse - _TC", item_code="_Test Item", qty=800, basic_rate=100) diff --git a/erpnext/accounts/doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py b/erpnext/accounts/doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py index f53a58bf32d..f9991e154b3 100644 --- a/erpnext/accounts/doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py +++ b/erpnext/accounts/doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py @@ -1,6 +1,5 @@ # Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import json import frappe diff --git a/erpnext/accounts/doctype/pos_opening_entry/test_pos_opening_entry.py b/erpnext/accounts/doctype/pos_opening_entry/test_pos_opening_entry.py index 64c658ab151..03bfc03bde2 100644 --- a/erpnext/accounts/doctype/pos_opening_entry/test_pos_opening_entry.py +++ b/erpnext/accounts/doctype/pos_opening_entry/test_pos_opening_entry.py @@ -1,12 +1,12 @@ # Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase -class TestPOSOpeningEntry(unittest.TestCase): +class TestPOSOpeningEntry(IntegrationTestCase): pass diff --git a/erpnext/accounts/doctype/pos_profile/test_pos_profile.py b/erpnext/accounts/doctype/pos_profile/test_pos_profile.py index f2e3c8fcf59..872742ce1bc 100644 --- a/erpnext/accounts/doctype/pos_profile/test_pos_profile.py +++ b/erpnext/accounts/doctype/pos_profile/test_pos_profile.py @@ -1,9 +1,9 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and Contributors # See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.pos_profile.pos_profile import ( get_child_nodes, @@ -13,7 +13,7 @@ from erpnext.stock.get_item_details import get_pos_profile test_dependencies = ["Item"] -class TestPOSProfile(unittest.TestCase): +class TestPOSProfile(IntegrationTestCase): def test_pos_profile(self): make_pos_profile() @@ -50,7 +50,7 @@ def get_customers_list(pos_profile=None): customer_groups.extend( [d.get("name") for d in get_child_nodes("Customer Group", d.get("customer_group"))] ) - cond = "customer_group in (%s)" % (", ".join(["%s"] * len(customer_groups))) + cond = "customer_group in ({})".format(", ".join(["%s"] * len(customer_groups))) return ( frappe.db.sql( @@ -72,7 +72,7 @@ def get_items_list(pos_profile, company): for d in pos_profile.get("item_groups"): args_list.extend([d.name for d in get_child_nodes("Item Group", d.item_group)]) if args_list: - cond = "and i.item_group in (%s)" % (", ".join(["%s"] * len(args_list))) + cond = "and i.item_group in ({})".format(", ".join(["%s"] * len(args_list))) return frappe.db.sql( f""" diff --git a/erpnext/accounts/doctype/pos_profile_user/test_pos_profile_user.py b/erpnext/accounts/doctype/pos_profile_user/test_pos_profile_user.py index 3aafb1df32c..b9747ff5799 100644 --- a/erpnext/accounts/doctype/pos_profile_user/test_pos_profile_user.py +++ b/erpnext/accounts/doctype/pos_profile_user/test_pos_profile_user.py @@ -1,8 +1,9 @@ # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest +from frappe.tests import IntegrationTestCase -class TestPOSProfileUser(unittest.TestCase): + +class TestPOSProfileUser(IntegrationTestCase): pass diff --git a/erpnext/accounts/doctype/pos_settings/test_pos_settings.py b/erpnext/accounts/doctype/pos_settings/test_pos_settings.py index 630b30564ad..1ae75140714 100644 --- a/erpnext/accounts/doctype/pos_settings/test_pos_settings.py +++ b/erpnext/accounts/doctype/pos_settings/test_pos_settings.py @@ -1,8 +1,9 @@ # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest +from frappe.tests import IntegrationTestCase -class TestPOSSettings(unittest.TestCase): + +class TestPOSSettings(IntegrationTestCase): pass diff --git a/erpnext/accounts/doctype/process_deferred_accounting/test_process_deferred_accounting.py b/erpnext/accounts/doctype/process_deferred_accounting/test_process_deferred_accounting.py index fddd9f83926..2764ec5c951 100644 --- a/erpnext/accounts/doctype/process_deferred_accounting/test_process_deferred_accounting.py +++ b/erpnext/accounts/doctype/process_deferred_accounting/test_process_deferred_accounting.py @@ -1,9 +1,9 @@ # Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.account.test_account import create_account from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import ( @@ -13,7 +13,7 @@ from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import ( from erpnext.stock.doctype.item.test_item import create_item -class TestProcessDeferredAccounting(unittest.TestCase): +class TestProcessDeferredAccounting(IntegrationTestCase): def test_creation_of_ledger_entry_on_submit(self): """test creation of gl entries on submission of document""" change_acc_settings(acc_frozen_upto="2023-05-31", book_deferred_entries_based_on="Months") diff --git a/erpnext/accounts/doctype/promotional_scheme/test_promotional_scheme.py b/erpnext/accounts/doctype/promotional_scheme/test_promotional_scheme.py index 74ba6cf923c..2e75db4c31c 100644 --- a/erpnext/accounts/doctype/promotional_scheme/test_promotional_scheme.py +++ b/erpnext/accounts/doctype/promotional_scheme/test_promotional_scheme.py @@ -1,15 +1,15 @@ # Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.promotional_scheme.promotional_scheme import TransactionExists from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order -class TestPromotionalScheme(unittest.TestCase): +class TestPromotionalScheme(IntegrationTestCase): def setUp(self): if frappe.db.exists("Promotional Scheme", "_Test Scheme"): frappe.delete_doc("Promotional Scheme", "_Test Scheme") diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges_template/test_purchase_taxes_and_charges_template.py b/erpnext/accounts/doctype/purchase_taxes_and_charges_template/test_purchase_taxes_and_charges_template.py index 1d02f055048..16126deb7b0 100644 --- a/erpnext/accounts/doctype/purchase_taxes_and_charges_template/test_purchase_taxes_and_charges_template.py +++ b/erpnext/accounts/doctype/purchase_taxes_and_charges_template/test_purchase_taxes_and_charges_template.py @@ -1,10 +1,11 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and Contributors # See license.txt - import unittest +from frappe.tests import IntegrationTestCase + # test_records = frappe.get_test_records('Purchase Taxes and Charges Template') -class TestPurchaseTaxesandChargesTemplate(unittest.TestCase): +class TestPurchaseTaxesandChargesTemplate(IntegrationTestCase): pass diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_template/test_sales_taxes_and_charges_template.py b/erpnext/accounts/doctype/sales_taxes_and_charges_template/test_sales_taxes_and_charges_template.py index 972b773501a..0e28db74441 100644 --- a/erpnext/accounts/doctype/sales_taxes_and_charges_template/test_sales_taxes_and_charges_template.py +++ b/erpnext/accounts/doctype/sales_taxes_and_charges_template/test_sales_taxes_and_charges_template.py @@ -1,12 +1,12 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and Contributors # See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase test_records = frappe.get_test_records("Sales Taxes and Charges Template") -class TestSalesTaxesandChargesTemplate(unittest.TestCase): +class TestSalesTaxesandChargesTemplate(IntegrationTestCase): pass diff --git a/erpnext/accounts/doctype/share_transfer/test_share_transfer.py b/erpnext/accounts/doctype/share_transfer/test_share_transfer.py index 97310743605..11449b0887d 100644 --- a/erpnext/accounts/doctype/share_transfer/test_share_transfer.py +++ b/erpnext/accounts/doctype/share_transfer/test_share_transfer.py @@ -1,16 +1,16 @@ # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.share_transfer.share_transfer import ShareDontExists test_dependencies = ["Share Type", "Shareholder"] -class TestShareTransfer(unittest.TestCase): +class TestShareTransfer(IntegrationTestCase): def setUp(self): frappe.db.sql("delete from `tabShare Transfer`") frappe.db.sql("delete from `tabShare Balance`") diff --git a/erpnext/accounts/doctype/share_type/test_share_type.py b/erpnext/accounts/doctype/share_type/test_share_type.py index b911c98388c..e6f1f71f4bb 100644 --- a/erpnext/accounts/doctype/share_type/test_share_type.py +++ b/erpnext/accounts/doctype/share_type/test_share_type.py @@ -1,8 +1,9 @@ # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest +from frappe.tests import IntegrationTestCase -class TestShareType(unittest.TestCase): + +class TestShareType(IntegrationTestCase): pass diff --git a/erpnext/accounts/doctype/shareholder/test_shareholder.py b/erpnext/accounts/doctype/shareholder/test_shareholder.py index 376ea711526..3c0f34858f9 100644 --- a/erpnext/accounts/doctype/shareholder/test_shareholder.py +++ b/erpnext/accounts/doctype/shareholder/test_shareholder.py @@ -1,8 +1,9 @@ # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest +from frappe.tests import IntegrationTestCase -class TestShareholder(unittest.TestCase): + +class TestShareholder(IntegrationTestCase): pass diff --git a/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py b/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py index a5a0ada8ba5..d5835bfb8e9 100644 --- a/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py +++ b/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py @@ -1,9 +1,9 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.shipping_rule.shipping_rule import ( FromGreaterThanToError, @@ -14,7 +14,7 @@ from erpnext.accounts.doctype.shipping_rule.shipping_rule import ( test_records = frappe.get_test_records("Shipping Rule") -class TestShippingRule(unittest.TestCase): +class TestShippingRule(IntegrationTestCase): def test_from_greater_than_to(self): shipping_rule = frappe.copy_doc(test_records[0]) shipping_rule.name = test_records[0].get("name") diff --git a/erpnext/accounts/doctype/subscription_invoice/test_subscription_invoice.py b/erpnext/accounts/doctype/subscription_invoice/test_subscription_invoice.py index 5dc9e32c8e3..a176a99a9b8 100644 --- a/erpnext/accounts/doctype/subscription_invoice/test_subscription_invoice.py +++ b/erpnext/accounts/doctype/subscription_invoice/test_subscription_invoice.py @@ -1,8 +1,9 @@ # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest +from frappe.tests import IntegrationTestCase -class TestSubscriptionInvoice(unittest.TestCase): + +class TestSubscriptionInvoice(IntegrationTestCase): pass diff --git a/erpnext/accounts/doctype/subscription_plan/test_subscription_plan.py b/erpnext/accounts/doctype/subscription_plan/test_subscription_plan.py index 3b6ab605a45..19b9285b1d8 100644 --- a/erpnext/accounts/doctype/subscription_plan/test_subscription_plan.py +++ b/erpnext/accounts/doctype/subscription_plan/test_subscription_plan.py @@ -1,8 +1,9 @@ # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest +from frappe.tests import IntegrationTestCase -class TestSubscriptionPlan(unittest.TestCase): + +class TestSubscriptionPlan(IntegrationTestCase): pass diff --git a/erpnext/accounts/doctype/subscription_settings/test_subscription_settings.py b/erpnext/accounts/doctype/subscription_settings/test_subscription_settings.py index 63eae3bfeb3..5d6607cb0cd 100644 --- a/erpnext/accounts/doctype/subscription_settings/test_subscription_settings.py +++ b/erpnext/accounts/doctype/subscription_settings/test_subscription_settings.py @@ -1,8 +1,9 @@ # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest +from frappe.tests import IntegrationTestCase -class TestSubscriptionSettings(unittest.TestCase): + +class TestSubscriptionSettings(IntegrationTestCase): pass diff --git a/erpnext/accounts/doctype/tax_category/test_tax_category.py b/erpnext/accounts/doctype/tax_category/test_tax_category.py index e3b3430ace5..fbe654999f1 100644 --- a/erpnext/accounts/doctype/tax_category/test_tax_category.py +++ b/erpnext/accounts/doctype/tax_category/test_tax_category.py @@ -1,8 +1,9 @@ # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest +from frappe.tests import IntegrationTestCase -class TestTaxCategory(unittest.TestCase): + +class TestTaxCategory(IntegrationTestCase): pass diff --git a/erpnext/accounts/doctype/tax_rule/test_tax_rule.py b/erpnext/accounts/doctype/tax_rule/test_tax_rule.py index 335b4835630..74bbf7c52b5 100644 --- a/erpnext/accounts/doctype/tax_rule/test_tax_rule.py +++ b/erpnext/accounts/doctype/tax_rule/test_tax_rule.py @@ -1,9 +1,9 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.tax_rule.tax_rule import ConflictingTaxRule, get_tax_template from erpnext.crm.doctype.opportunity.opportunity import make_quotation @@ -12,7 +12,7 @@ from erpnext.crm.doctype.opportunity.test_opportunity import make_opportunity test_records = frappe.get_test_records("Tax Rule") -class TestTaxRule(unittest.TestCase): +class TestTaxRule(IntegrationTestCase): @classmethod def setUpClass(cls): frappe.db.set_single_value("Shopping Cart Settings", "enabled", 0) diff --git a/erpnext/accounts/report/account_balance/test_account_balance.py b/erpnext/accounts/report/account_balance/test_account_balance.py index 13fa05d4743..dd265ce94bc 100644 --- a/erpnext/accounts/report/account_balance/test_account_balance.py +++ b/erpnext/accounts/report/account_balance/test_account_balance.py @@ -1,13 +1,14 @@ import unittest import frappe +from frappe.tests import IntegrationTestCase from frappe.utils import getdate from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.accounts.report.account_balance.account_balance import execute -class TestAccountBalance(unittest.TestCase): +class TestAccountBalance(IntegrationTestCase): def test_account_balance(self): frappe.db.sql("delete from `tabSales Invoice` where company='_Test Company 2'") frappe.db.sql("delete from `tabGL Entry` where company='_Test Company 2'") diff --git a/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py b/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py index 3be96c6de93..9d605b80c5f 100644 --- a/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py +++ b/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py @@ -1,10 +1,9 @@ # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt - - import unittest import frappe +from frappe.tests import IntegrationTestCase from frappe.utils import today from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry @@ -16,7 +15,7 @@ from erpnext.accounts.report.sales_payment_summary.sales_payment_summary import test_dependencies = ["Sales Invoice"] -class TestSalesPaymentSummary(unittest.TestCase): +class TestSalesPaymentSummary(IntegrationTestCase): @classmethod def setUpClass(self): create_records() diff --git a/erpnext/accounts/test/test_reports.py b/erpnext/accounts/test/test_reports.py index 56b7832a32e..827b5224d6e 100644 --- a/erpnext/accounts/test/test_reports.py +++ b/erpnext/accounts/test/test_reports.py @@ -1,5 +1,7 @@ import unittest +from frappe.tests import IntegrationTestCase + from erpnext.tests.utils import ReportFilters, ReportName, execute_script_report DEFAULT_FILTERS = { @@ -34,7 +36,7 @@ REPORT_FILTER_TEST_CASES: list[tuple[ReportName, ReportFilters]] = [ OPTIONAL_FILTERS = {} -class TestReports(unittest.TestCase): +class TestReports(IntegrationTestCase): def test_execute_all_accounts_reports(self): """Test that all script report in stock modules are executable with supported filters""" for report, filter in REPORT_FILTER_TEST_CASES: diff --git a/erpnext/accounts/test/test_utils.py b/erpnext/accounts/test/test_utils.py index 59cbc11794f..5db0a889717 100644 --- a/erpnext/accounts/test/test_utils.py +++ b/erpnext/accounts/test/test_utils.py @@ -2,6 +2,7 @@ import unittest import frappe from frappe.test_runner import make_test_objects +from frappe.tests import IntegrationTestCase from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice @@ -16,7 +17,7 @@ from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_pu from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry -class TestUtils(unittest.TestCase): +class TestUtils(IntegrationTestCase): @classmethod def setUpClass(cls): super().setUpClass() diff --git a/erpnext/assets/doctype/asset/test_asset.py b/erpnext/assets/doctype/asset/test_asset.py index 4271540c33b..431110a382a 100644 --- a/erpnext/assets/doctype/asset/test_asset.py +++ b/erpnext/assets/doctype/asset/test_asset.py @@ -1,9 +1,9 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase from frappe.utils import ( add_days, add_months, @@ -42,7 +42,7 @@ from erpnext.stock.doctype.purchase_receipt.purchase_receipt import ( from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt -class AssetSetup(unittest.TestCase): +class AssetSetup(IntegrationTestCase): @classmethod def setUpClass(cls): set_depreciation_settings_in_company() diff --git a/erpnext/assets/doctype/asset_capitalization/test_asset_capitalization.py b/erpnext/assets/doctype/asset_capitalization/test_asset_capitalization.py index 86293fac765..1004c739a9a 100644 --- a/erpnext/assets/doctype/asset_capitalization/test_asset_capitalization.py +++ b/erpnext/assets/doctype/asset_capitalization/test_asset_capitalization.py @@ -1,9 +1,9 @@ # Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase from frappe.utils import cint, flt, getdate, now_datetime from erpnext.assets.doctype.asset.depreciation import post_depreciation_entries @@ -21,7 +21,7 @@ from erpnext.stock.doctype.serial_and_batch_bundle.test_serial_and_batch_bundle ) -class TestAssetCapitalization(unittest.TestCase): +class TestAssetCapitalization(IntegrationTestCase): def setUp(self): set_depreciation_settings_in_company() create_asset_data() diff --git a/erpnext/assets/doctype/asset_category/test_asset_category.py b/erpnext/assets/doctype/asset_category/test_asset_category.py index 516e27e00fa..0f903c7f03a 100644 --- a/erpnext/assets/doctype/asset_category/test_asset_category.py +++ b/erpnext/assets/doctype/asset_category/test_asset_category.py @@ -1,12 +1,12 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase -class TestAssetCategory(unittest.TestCase): +class TestAssetCategory(IntegrationTestCase): def test_mandatory_fields(self): asset_category = frappe.new_doc("Asset Category") asset_category.asset_category_name = "Computers" diff --git a/erpnext/assets/doctype/asset_maintenance/test_asset_maintenance.py b/erpnext/assets/doctype/asset_maintenance/test_asset_maintenance.py index a33acfd8330..391872c8438 100644 --- a/erpnext/assets/doctype/asset_maintenance/test_asset_maintenance.py +++ b/erpnext/assets/doctype/asset_maintenance/test_asset_maintenance.py @@ -1,16 +1,16 @@ # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase from frappe.utils import add_days, get_last_day, nowdate from erpnext.assets.doctype.asset_maintenance.asset_maintenance import calculate_next_due_date from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt -class TestAssetMaintenance(unittest.TestCase): +class TestAssetMaintenance(IntegrationTestCase): def setUp(self): set_depreciation_settings_in_company() self.pr = make_purchase_receipt( diff --git a/erpnext/assets/doctype/asset_maintenance_log/test_asset_maintenance_log.py b/erpnext/assets/doctype/asset_maintenance_log/test_asset_maintenance_log.py index 9980ff31f62..6d19f5b17d9 100644 --- a/erpnext/assets/doctype/asset_maintenance_log/test_asset_maintenance_log.py +++ b/erpnext/assets/doctype/asset_maintenance_log/test_asset_maintenance_log.py @@ -1,8 +1,9 @@ # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest +from frappe.tests import IntegrationTestCase -class TestAssetMaintenanceLog(unittest.TestCase): + +class TestAssetMaintenanceLog(IntegrationTestCase): pass diff --git a/erpnext/assets/doctype/asset_maintenance_team/test_asset_maintenance_team.py b/erpnext/assets/doctype/asset_maintenance_team/test_asset_maintenance_team.py index 732ab4ae484..00441a8368a 100644 --- a/erpnext/assets/doctype/asset_maintenance_team/test_asset_maintenance_team.py +++ b/erpnext/assets/doctype/asset_maintenance_team/test_asset_maintenance_team.py @@ -1,8 +1,9 @@ # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest +from frappe.tests import IntegrationTestCase -class TestAssetMaintenanceTeam(unittest.TestCase): + +class TestAssetMaintenanceTeam(IntegrationTestCase): pass diff --git a/erpnext/assets/doctype/asset_movement/test_asset_movement.py b/erpnext/assets/doctype/asset_movement/test_asset_movement.py index 52590d2ba86..6ecfa2b6a6f 100644 --- a/erpnext/assets/doctype/asset_movement/test_asset_movement.py +++ b/erpnext/assets/doctype/asset_movement/test_asset_movement.py @@ -1,9 +1,9 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase from frappe.utils import now from erpnext.assets.doctype.asset.test_asset import create_asset_data @@ -11,7 +11,7 @@ from erpnext.setup.doctype.employee.test_employee import make_employee from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt -class TestAssetMovement(unittest.TestCase): +class TestAssetMovement(IntegrationTestCase): def setUp(self): frappe.db.set_value( "Company", "_Test Company", "capital_work_in_progress_account", "CWIP Account - _TC" diff --git a/erpnext/assets/doctype/asset_repair/test_asset_repair.py b/erpnext/assets/doctype/asset_repair/test_asset_repair.py index 48f67038f4d..33b77c557cc 100644 --- a/erpnext/assets/doctype/asset_repair/test_asset_repair.py +++ b/erpnext/assets/doctype/asset_repair/test_asset_repair.py @@ -1,9 +1,9 @@ # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase from frappe.utils import flt, nowdate, nowtime, today from erpnext.assets.doctype.asset.asset import ( @@ -25,7 +25,7 @@ from erpnext.stock.doctype.serial_and_batch_bundle.test_serial_and_batch_bundle ) -class TestAssetRepair(unittest.TestCase): +class TestAssetRepair(IntegrationTestCase): @classmethod def setUpClass(cls): set_depreciation_settings_in_company() diff --git a/erpnext/assets/doctype/asset_value_adjustment/test_asset_value_adjustment.py b/erpnext/assets/doctype/asset_value_adjustment/test_asset_value_adjustment.py index 1280bd929f2..bfb34023089 100644 --- a/erpnext/assets/doctype/asset_value_adjustment/test_asset_value_adjustment.py +++ b/erpnext/assets/doctype/asset_value_adjustment/test_asset_value_adjustment.py @@ -1,9 +1,9 @@ # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase from frappe.utils import add_days, cstr, get_last_day, getdate, nowdate from erpnext.assets.doctype.asset.asset import get_asset_value_after_depreciation @@ -16,7 +16,7 @@ from erpnext.assets.doctype.asset_repair.test_asset_repair import create_asset_r from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt -class TestAssetValueAdjustment(unittest.TestCase): +class TestAssetValueAdjustment(IntegrationTestCase): def setUp(self): create_asset_data() frappe.db.set_value( diff --git a/erpnext/assets/doctype/location/test_location.py b/erpnext/assets/doctype/location/test_location.py index 3b5af61fd44..62babd2e674 100644 --- a/erpnext/assets/doctype/location/test_location.py +++ b/erpnext/assets/doctype/location/test_location.py @@ -1,15 +1,15 @@ # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import json import unittest import frappe +from frappe.tests import IntegrationTestCase test_records = frappe.get_test_records("Location") -class TestLocation(unittest.TestCase): +class TestLocation(IntegrationTestCase): def runTest(self): locations = ["Basil Farm", "Division 1", "Field 1", "Block 1"] area = 0 diff --git a/erpnext/assets/doctype/maintenance_team_member/test_maintenance_team_member.py b/erpnext/assets/doctype/maintenance_team_member/test_maintenance_team_member.py index 911a6544e9a..a4795c54a56 100644 --- a/erpnext/assets/doctype/maintenance_team_member/test_maintenance_team_member.py +++ b/erpnext/assets/doctype/maintenance_team_member/test_maintenance_team_member.py @@ -1,8 +1,9 @@ # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest +from frappe.tests import IntegrationTestCase -class TestMaintenanceTeamMember(unittest.TestCase): + +class TestMaintenanceTeamMember(IntegrationTestCase): pass diff --git a/erpnext/buying/doctype/buying_settings/test_buying_settings.py b/erpnext/buying/doctype/buying_settings/test_buying_settings.py index cdb691de0c3..04f95dbe745 100644 --- a/erpnext/buying/doctype/buying_settings/test_buying_settings.py +++ b/erpnext/buying/doctype/buying_settings/test_buying_settings.py @@ -1,9 +1,10 @@ # Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - # import frappe import unittest +from frappe.tests import IntegrationTestCase -class TestBuyingSettings(unittest.TestCase): + +class TestBuyingSettings(IntegrationTestCase): pass diff --git a/erpnext/buying/doctype/supplier_scorecard_period/test_supplier_scorecard_period.py b/erpnext/buying/doctype/supplier_scorecard_period/test_supplier_scorecard_period.py index 005cd791700..2b124dede99 100644 --- a/erpnext/buying/doctype/supplier_scorecard_period/test_supplier_scorecard_period.py +++ b/erpnext/buying/doctype/supplier_scorecard_period/test_supplier_scorecard_period.py @@ -1,8 +1,9 @@ # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest +from frappe.tests import IntegrationTestCase -class TestSupplierScorecardPeriod(unittest.TestCase): + +class TestSupplierScorecardPeriod(IntegrationTestCase): pass diff --git a/erpnext/buying/doctype/supplier_scorecard_standing/test_supplier_scorecard_standing.py b/erpnext/buying/doctype/supplier_scorecard_standing/test_supplier_scorecard_standing.py index bd1b0ad7f61..32581538b03 100644 --- a/erpnext/buying/doctype/supplier_scorecard_standing/test_supplier_scorecard_standing.py +++ b/erpnext/buying/doctype/supplier_scorecard_standing/test_supplier_scorecard_standing.py @@ -1,8 +1,9 @@ # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest +from frappe.tests import IntegrationTestCase -class TestSupplierScorecardStanding(unittest.TestCase): + +class TestSupplierScorecardStanding(IntegrationTestCase): pass diff --git a/erpnext/controllers/tests/test_item_variant.py b/erpnext/controllers/tests/test_item_variant.py index 68c8d2cd2c3..585a63ca798 100644 --- a/erpnext/controllers/tests/test_item_variant.py +++ b/erpnext/controllers/tests/test_item_variant.py @@ -2,6 +2,7 @@ import json import unittest import frappe +from frappe.tests import IntegrationTestCase from erpnext.controllers.item_variant import copy_attributes_to_variant, make_variant_item_code from erpnext.stock.doctype.item.test_item import set_item_variant_settings @@ -10,7 +11,7 @@ from erpnext.stock.doctype.quality_inspection.test_quality_inspection import ( ) -class TestItemVariant(unittest.TestCase): +class TestItemVariant(IntegrationTestCase): def test_tables_in_template_copied_to_variant(self): fields = [{"field_name": "quality_inspection_template"}] set_item_variant_settings(fields) diff --git a/erpnext/controllers/tests/test_mapper.py b/erpnext/controllers/tests/test_mapper.py index 340df56fa0e..0a7c3815a19 100644 --- a/erpnext/controllers/tests/test_mapper.py +++ b/erpnext/controllers/tests/test_mapper.py @@ -4,11 +4,12 @@ import unittest import frappe import frappe.utils from frappe.model import mapper +from frappe.tests import IntegrationTestCase from frappe.tests.utils import make_test_records from frappe.utils import add_months, nowdate -class TestMapper(unittest.TestCase): +class TestMapper(IntegrationTestCase): def test_map_docs(self): """Test mapping of multiple source docs on a single target doc""" diff --git a/erpnext/controllers/tests/test_qty_based_taxes.py b/erpnext/controllers/tests/test_qty_based_taxes.py index e7896b57f23..d2fefa5b3b6 100644 --- a/erpnext/controllers/tests/test_qty_based_taxes.py +++ b/erpnext/controllers/tests/test_qty_based_taxes.py @@ -2,13 +2,14 @@ import unittest from uuid import uuid4 as _uuid4 import frappe +from frappe.tests import IntegrationTestCase def uuid4(): return str(_uuid4()) -class TestTaxes(unittest.TestCase): +class TestTaxes(IntegrationTestCase): def setUp(self): self.company = frappe.get_doc( { diff --git a/erpnext/controllers/tests/test_queries.py b/erpnext/controllers/tests/test_queries.py index 0ef108e5f7b..b1c2b53f69c 100644 --- a/erpnext/controllers/tests/test_queries.py +++ b/erpnext/controllers/tests/test_queries.py @@ -2,6 +2,7 @@ import unittest from functools import partial import frappe +from frappe.tests import IntegrationTestCase from erpnext.controllers import queries @@ -10,7 +11,7 @@ def add_default_params(func, doctype): return partial(func, doctype=doctype, txt="", searchfield="name", start=0, page_len=20, filters=None) -class TestQueries(unittest.TestCase): +class TestQueries(IntegrationTestCase): # All tests are based on doctype/test_records.json def assert_nested_in(self, item, container): diff --git a/erpnext/controllers/tests/test_transaction_base.py b/erpnext/controllers/tests/test_transaction_base.py index ab5525a7f06..cfb2dffabb6 100644 --- a/erpnext/controllers/tests/test_transaction_base.py +++ b/erpnext/controllers/tests/test_transaction_base.py @@ -1,9 +1,10 @@ import unittest import frappe +from frappe.tests import IntegrationTestCase -class TestUtils(unittest.TestCase): +class TestUtils(IntegrationTestCase): def test_reset_default_field_value(self): doc = frappe.get_doc( { diff --git a/erpnext/crm/doctype/appointment/test_appointment.py b/erpnext/crm/doctype/appointment/test_appointment.py index 178b9d2de53..3e5f2526a76 100644 --- a/erpnext/crm/doctype/appointment/test_appointment.py +++ b/erpnext/crm/doctype/appointment/test_appointment.py @@ -1,10 +1,10 @@ # Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import datetime import unittest import frappe +from frappe.tests import IntegrationTestCase LEAD_EMAIL = "test_appointment_lead@example.com" @@ -26,7 +26,7 @@ def create_test_appointment(): return test_appointment -class TestAppointment(unittest.TestCase): +class TestAppointment(IntegrationTestCase): def setUpClass(): frappe.db.delete("Lead", {"email_id": LEAD_EMAIL}) diff --git a/erpnext/crm/doctype/appointment_booking_settings/test_appointment_booking_settings.py b/erpnext/crm/doctype/appointment_booking_settings/test_appointment_booking_settings.py index bc68bbd86c6..0fca8a59da3 100644 --- a/erpnext/crm/doctype/appointment_booking_settings/test_appointment_booking_settings.py +++ b/erpnext/crm/doctype/appointment_booking_settings/test_appointment_booking_settings.py @@ -1,9 +1,10 @@ # Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - # import frappe import unittest +from frappe.tests import IntegrationTestCase -class TestAppointmentBookingSettings(unittest.TestCase): + +class TestAppointmentBookingSettings(IntegrationTestCase): pass diff --git a/erpnext/crm/doctype/campaign/test_campaign.py b/erpnext/crm/doctype/campaign/test_campaign.py index 2e25eb6a790..878c18664ad 100644 --- a/erpnext/crm/doctype/campaign/test_campaign.py +++ b/erpnext/crm/doctype/campaign/test_campaign.py @@ -1,9 +1,10 @@ # Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - # import frappe import unittest +from frappe.tests import IntegrationTestCase -class TestCampaign(unittest.TestCase): + +class TestCampaign(IntegrationTestCase): pass diff --git a/erpnext/crm/doctype/competitor/test_competitor.py b/erpnext/crm/doctype/competitor/test_competitor.py index f77d7e658dc..2fbe068e8a7 100644 --- a/erpnext/crm/doctype/competitor/test_competitor.py +++ b/erpnext/crm/doctype/competitor/test_competitor.py @@ -1,9 +1,10 @@ # Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - # import frappe import unittest +from frappe.tests import IntegrationTestCase -class TestCompetitor(unittest.TestCase): + +class TestCompetitor(IntegrationTestCase): pass diff --git a/erpnext/crm/doctype/contract/test_contract.py b/erpnext/crm/doctype/contract/test_contract.py index 13901683de8..2ea083834ce 100644 --- a/erpnext/crm/doctype/contract/test_contract.py +++ b/erpnext/crm/doctype/contract/test_contract.py @@ -1,13 +1,13 @@ # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase from frappe.utils import add_days, nowdate -class TestContract(unittest.TestCase): +class TestContract(IntegrationTestCase): def setUp(self): frappe.db.sql("delete from `tabContract`") self.contract_doc = get_contract() diff --git a/erpnext/crm/doctype/contract_fulfilment_checklist/test_contract_fulfilment_checklist.py b/erpnext/crm/doctype/contract_fulfilment_checklist/test_contract_fulfilment_checklist.py index dfcbdfc9f96..becb1674190 100644 --- a/erpnext/crm/doctype/contract_fulfilment_checklist/test_contract_fulfilment_checklist.py +++ b/erpnext/crm/doctype/contract_fulfilment_checklist/test_contract_fulfilment_checklist.py @@ -1,8 +1,9 @@ # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest +from frappe.tests import IntegrationTestCase -class TestContractFulfilmentChecklist(unittest.TestCase): + +class TestContractFulfilmentChecklist(IntegrationTestCase): pass diff --git a/erpnext/crm/doctype/contract_template/test_contract_template.py b/erpnext/crm/doctype/contract_template/test_contract_template.py index 773d81e6584..4b2911945d0 100644 --- a/erpnext/crm/doctype/contract_template/test_contract_template.py +++ b/erpnext/crm/doctype/contract_template/test_contract_template.py @@ -1,8 +1,9 @@ # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest +from frappe.tests import IntegrationTestCase -class TestContractTemplate(unittest.TestCase): + +class TestContractTemplate(IntegrationTestCase): pass diff --git a/erpnext/crm/doctype/crm_settings/test_crm_settings.py b/erpnext/crm/doctype/crm_settings/test_crm_settings.py index 3372c5deb4b..22109d960dd 100644 --- a/erpnext/crm/doctype/crm_settings/test_crm_settings.py +++ b/erpnext/crm/doctype/crm_settings/test_crm_settings.py @@ -1,9 +1,10 @@ # Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - # import frappe import unittest +from frappe.tests import IntegrationTestCase -class TestCRMSettings(unittest.TestCase): + +class TestCRMSettings(IntegrationTestCase): pass diff --git a/erpnext/crm/doctype/email_campaign/test_email_campaign.py b/erpnext/crm/doctype/email_campaign/test_email_campaign.py index 997d903c578..b94a41e7820 100644 --- a/erpnext/crm/doctype/email_campaign/test_email_campaign.py +++ b/erpnext/crm/doctype/email_campaign/test_email_campaign.py @@ -1,9 +1,10 @@ # Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - # import frappe import unittest +from frappe.tests import IntegrationTestCase -class TestEmailCampaign(unittest.TestCase): + +class TestEmailCampaign(IntegrationTestCase): pass diff --git a/erpnext/crm/doctype/lead/test_lead.py b/erpnext/crm/doctype/lead/test_lead.py index bab9947b333..a9ee1aaa9ad 100644 --- a/erpnext/crm/doctype/lead/test_lead.py +++ b/erpnext/crm/doctype/lead/test_lead.py @@ -1,10 +1,9 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt - - import unittest import frappe +from frappe.tests import IntegrationTestCase from frappe.utils import random_string, today from erpnext.crm.doctype.lead.lead import make_opportunity @@ -13,7 +12,7 @@ from erpnext.crm.utils import get_linked_prospect test_records = frappe.get_test_records("Lead") -class TestLead(unittest.TestCase): +class TestLead(IntegrationTestCase): def test_make_customer(self): from erpnext.crm.doctype.lead.lead import make_customer diff --git a/erpnext/crm/doctype/market_segment/test_market_segment.py b/erpnext/crm/doctype/market_segment/test_market_segment.py index 20b73b15311..4f42f704309 100644 --- a/erpnext/crm/doctype/market_segment/test_market_segment.py +++ b/erpnext/crm/doctype/market_segment/test_market_segment.py @@ -1,8 +1,9 @@ # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest +from frappe.tests import IntegrationTestCase -class TestMarketSegment(unittest.TestCase): + +class TestMarketSegment(IntegrationTestCase): pass diff --git a/erpnext/crm/doctype/opportunity/test_opportunity.py b/erpnext/crm/doctype/opportunity/test_opportunity.py index 6ec3ca4a6c1..03941372641 100644 --- a/erpnext/crm/doctype/opportunity/test_opportunity.py +++ b/erpnext/crm/doctype/opportunity/test_opportunity.py @@ -1,9 +1,9 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and Contributors # See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase from frappe.utils import now_datetime, random_string, today from erpnext.crm.doctype.lead.lead import make_customer @@ -14,7 +14,7 @@ from erpnext.crm.utils import get_linked_communication_list test_records = frappe.get_test_records("Opportunity") -class TestOpportunity(unittest.TestCase): +class TestOpportunity(IntegrationTestCase): def test_opportunity_status(self): doc = make_opportunity(with_items=0) quotation = make_quotation(doc.name) diff --git a/erpnext/crm/doctype/opportunity_type/test_opportunity_type.py b/erpnext/crm/doctype/opportunity_type/test_opportunity_type.py index ae0d7827cc7..91bbd0d7095 100644 --- a/erpnext/crm/doctype/opportunity_type/test_opportunity_type.py +++ b/erpnext/crm/doctype/opportunity_type/test_opportunity_type.py @@ -1,8 +1,9 @@ # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest +from frappe.tests import IntegrationTestCase -class TestOpportunityType(unittest.TestCase): + +class TestOpportunityType(IntegrationTestCase): pass diff --git a/erpnext/crm/doctype/prospect/test_prospect.py b/erpnext/crm/doctype/prospect/test_prospect.py index 47e38515cac..d66f3d5a494 100644 --- a/erpnext/crm/doctype/prospect/test_prospect.py +++ b/erpnext/crm/doctype/prospect/test_prospect.py @@ -1,16 +1,16 @@ # Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase from frappe.utils import random_string from erpnext.crm.doctype.lead.lead import add_lead_to_prospect from erpnext.crm.doctype.lead.test_lead import make_lead -class TestProspect(unittest.TestCase): +class TestProspect(IntegrationTestCase): def test_add_lead_to_prospect_and_address_linking(self): lead_doc = make_lead() address_doc = make_address(address_title=lead_doc.name) diff --git a/erpnext/crm/doctype/sales_stage/test_sales_stage.py b/erpnext/crm/doctype/sales_stage/test_sales_stage.py index d088f968f52..24da6ce48f6 100644 --- a/erpnext/crm/doctype/sales_stage/test_sales_stage.py +++ b/erpnext/crm/doctype/sales_stage/test_sales_stage.py @@ -1,8 +1,9 @@ # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest +from frappe.tests import IntegrationTestCase -class TestSalesStage(unittest.TestCase): + +class TestSalesStage(IntegrationTestCase): pass diff --git a/erpnext/crm/report/opportunity_summary_by_sales_stage/test_opportunity_summary_by_sales_stage.py b/erpnext/crm/report/opportunity_summary_by_sales_stage/test_opportunity_summary_by_sales_stage.py index d15a80d4aee..1a6ffd5e717 100644 --- a/erpnext/crm/report/opportunity_summary_by_sales_stage/test_opportunity_summary_by_sales_stage.py +++ b/erpnext/crm/report/opportunity_summary_by_sales_stage/test_opportunity_summary_by_sales_stage.py @@ -1,6 +1,7 @@ import unittest import frappe +from frappe.tests import IntegrationTestCase from erpnext.crm.report.opportunity_summary_by_sales_stage.opportunity_summary_by_sales_stage import ( execute, @@ -12,7 +13,7 @@ from erpnext.crm.report.sales_pipeline_analytics.test_sales_pipeline_analytics i ) -class TestOpportunitySummaryBySalesStage(unittest.TestCase): +class TestOpportunitySummaryBySalesStage(IntegrationTestCase): @classmethod def setUpClass(self): frappe.db.delete("Opportunity")