From 9024621231202d5cdc128e10a5e1607ee5b8cf2f Mon Sep 17 00:00:00 2001 From: David Date: Tue, 8 Oct 2024 01:52:47 +0200 Subject: [PATCH] refactor: Use IntegrationTestCase in multiple files Signed-off-by: David --- .../doctype/quality_action/test_quality_action.py | 5 +++-- .../doctype/quality_feedback/test_quality_feedback.py | 4 ++-- .../test_quality_feedback_template.py | 5 +++-- .../doctype/quality_goal/test_quality_goal.py | 4 ++-- .../doctype/quality_meeting/test_quality_meeting.py | 5 +++-- .../quality_meeting_agenda/test_quality_meeting_agenda.py | 5 +++-- .../doctype/quality_review/test_quality_review.py | 4 ++-- .../import_supplier_invoice/test_import_supplier_invoice.py | 5 +++-- .../test_lower_deduction_certificate.py | 5 +++-- .../test_south_africa_vat_settings.py | 5 +++-- .../doctype/uae_vat_settings/test_uae_vat_settings.py | 5 +++-- erpnext/regional/united_states/test_united_states.py | 4 ++-- .../doctype/installation_note/test_installation_note.py | 5 +++-- .../doctype/sales_partner_type/test_sales_partner_type.py | 5 +++-- .../doctype/selling_settings/test_selling_settings.py | 4 ++-- .../doctype/authorization_rule/test_authorization_rule.py | 5 +++-- erpnext/setup/doctype/company/test_company.py | 4 ++-- .../doctype/currency_exchange/test_currency_exchange.py | 4 ++-- erpnext/setup/doctype/department/test_department.py | 4 ++-- erpnext/setup/doctype/driver/test_driver.py | 5 +++-- erpnext/setup/doctype/email_digest/test_email_digest.py | 5 +++-- 21 files changed, 55 insertions(+), 42 deletions(-) diff --git a/erpnext/quality_management/doctype/quality_action/test_quality_action.py b/erpnext/quality_management/doctype/quality_action/test_quality_action.py index fefa9dfe9cd..1e1dfc376bc 100644 --- a/erpnext/quality_management/doctype/quality_action/test_quality_action.py +++ b/erpnext/quality_management/doctype/quality_action/test_quality_action.py @@ -1,9 +1,10 @@ # Copyright (c) 2018, Frappe and Contributors # See license.txt - import unittest +from frappe.tests import IntegrationTestCase -class TestQualityAction(unittest.TestCase): + +class TestQualityAction(IntegrationTestCase): # quality action has no code pass diff --git a/erpnext/quality_management/doctype/quality_feedback/test_quality_feedback.py b/erpnext/quality_management/doctype/quality_feedback/test_quality_feedback.py index 58d06326a72..7baf908b3df 100644 --- a/erpnext/quality_management/doctype/quality_feedback/test_quality_feedback.py +++ b/erpnext/quality_management/doctype/quality_feedback/test_quality_feedback.py @@ -1,12 +1,12 @@ # Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase -class TestQualityFeedback(unittest.TestCase): +class TestQualityFeedback(IntegrationTestCase): def test_quality_feedback(self): template = frappe.get_doc( dict( diff --git a/erpnext/quality_management/doctype/quality_feedback_template/test_quality_feedback_template.py b/erpnext/quality_management/doctype/quality_feedback_template/test_quality_feedback_template.py index 4b8bc0f0437..2064bbc5513 100644 --- a/erpnext/quality_management/doctype/quality_feedback_template/test_quality_feedback_template.py +++ b/erpnext/quality_management/doctype/quality_feedback_template/test_quality_feedback_template.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 TestQualityFeedbackTemplate(unittest.TestCase): + +class TestQualityFeedbackTemplate(IntegrationTestCase): pass diff --git a/erpnext/quality_management/doctype/quality_goal/test_quality_goal.py b/erpnext/quality_management/doctype/quality_goal/test_quality_goal.py index 40606cdca76..1b3727500b3 100644 --- a/erpnext/quality_management/doctype/quality_goal/test_quality_goal.py +++ b/erpnext/quality_management/doctype/quality_goal/test_quality_goal.py @@ -1,12 +1,12 @@ # Copyright (c) 2018, Frappe and Contributors # See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase -class TestQualityGoal(unittest.TestCase): +class TestQualityGoal(IntegrationTestCase): def test_quality_goal(self): # no code, just a basic sanity check goal = get_quality_goal() diff --git a/erpnext/quality_management/doctype/quality_meeting/test_quality_meeting.py b/erpnext/quality_management/doctype/quality_meeting/test_quality_meeting.py index 910b8a1130a..e0ff7d77f24 100644 --- a/erpnext/quality_management/doctype/quality_meeting/test_quality_meeting.py +++ b/erpnext/quality_management/doctype/quality_meeting/test_quality_meeting.py @@ -1,9 +1,10 @@ # Copyright (c) 2018, Frappe and Contributors # See license.txt - import unittest +from frappe.tests import IntegrationTestCase -class TestQualityMeeting(unittest.TestCase): + +class TestQualityMeeting(IntegrationTestCase): # nothing to test pass diff --git a/erpnext/quality_management/doctype/quality_meeting_agenda/test_quality_meeting_agenda.py b/erpnext/quality_management/doctype/quality_meeting_agenda/test_quality_meeting_agenda.py index 8b09f6db7fc..e83a3e394e1 100644 --- a/erpnext/quality_management/doctype/quality_meeting_agenda/test_quality_meeting_agenda.py +++ b/erpnext/quality_management/doctype/quality_meeting_agenda/test_quality_meeting_agenda.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 TestQualityMeetingAgenda(unittest.TestCase): + +class TestQualityMeetingAgenda(IntegrationTestCase): pass diff --git a/erpnext/quality_management/doctype/quality_review/test_quality_review.py b/erpnext/quality_management/doctype/quality_review/test_quality_review.py index c76e7f2731a..a3c78c5a416 100644 --- a/erpnext/quality_management/doctype/quality_review/test_quality_review.py +++ b/erpnext/quality_management/doctype/quality_review/test_quality_review.py @@ -1,15 +1,15 @@ # Copyright (c) 2018, Frappe and Contributors # See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase from ..quality_goal.test_quality_goal import get_quality_goal from .quality_review import review -class TestQualityReview(unittest.TestCase): +class TestQualityReview(IntegrationTestCase): def test_review_creation(self): quality_goal = get_quality_goal() review() diff --git a/erpnext/regional/doctype/import_supplier_invoice/test_import_supplier_invoice.py b/erpnext/regional/doctype/import_supplier_invoice/test_import_supplier_invoice.py index 78c07c558a5..7d512dbfb55 100644 --- a/erpnext/regional/doctype/import_supplier_invoice/test_import_supplier_invoice.py +++ b/erpnext/regional/doctype/import_supplier_invoice/test_import_supplier_invoice.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 TestImportSupplierInvoice(unittest.TestCase): + +class TestImportSupplierInvoice(IntegrationTestCase): pass diff --git a/erpnext/regional/doctype/lower_deduction_certificate/test_lower_deduction_certificate.py b/erpnext/regional/doctype/lower_deduction_certificate/test_lower_deduction_certificate.py index d8e78019311..f6ceb56557b 100644 --- a/erpnext/regional/doctype/lower_deduction_certificate/test_lower_deduction_certificate.py +++ b/erpnext/regional/doctype/lower_deduction_certificate/test_lower_deduction_certificate.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 TestLowerDeductionCertificate(unittest.TestCase): + +class TestLowerDeductionCertificate(IntegrationTestCase): pass diff --git a/erpnext/regional/doctype/south_africa_vat_settings/test_south_africa_vat_settings.py b/erpnext/regional/doctype/south_africa_vat_settings/test_south_africa_vat_settings.py index 0f19f25f88d..9ed34764f70 100644 --- a/erpnext/regional/doctype/south_africa_vat_settings/test_south_africa_vat_settings.py +++ b/erpnext/regional/doctype/south_africa_vat_settings/test_south_africa_vat_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 TestSouthAfricaVATSettings(unittest.TestCase): + +class TestSouthAfricaVATSettings(IntegrationTestCase): pass diff --git a/erpnext/regional/doctype/uae_vat_settings/test_uae_vat_settings.py b/erpnext/regional/doctype/uae_vat_settings/test_uae_vat_settings.py index 464c2e67be2..8d21d08b798 100644 --- a/erpnext/regional/doctype/uae_vat_settings/test_uae_vat_settings.py +++ b/erpnext/regional/doctype/uae_vat_settings/test_uae_vat_settings.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 TestUAEVATSettings(unittest.TestCase): + +class TestUAEVATSettings(IntegrationTestCase): pass diff --git a/erpnext/regional/united_states/test_united_states.py b/erpnext/regional/united_states/test_united_states.py index e54552b0332..d3e7dcda620 100644 --- a/erpnext/regional/united_states/test_united_states.py +++ b/erpnext/regional/united_states/test_united_states.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 from erpnext.regional.report.irs_1099.irs_1099 import execute as execute_1099_report -class TestUnitedStates(unittest.TestCase): +class TestUnitedStates(IntegrationTestCase): def test_irs_1099_custom_field(self): if not frappe.db.exists("Supplier", "_US 1099 Test Supplier"): doc = frappe.new_doc("Supplier") diff --git a/erpnext/selling/doctype/installation_note/test_installation_note.py b/erpnext/selling/doctype/installation_note/test_installation_note.py index 56e0fe160ab..b60d2cb8a97 100644 --- a/erpnext/selling/doctype/installation_note/test_installation_note.py +++ b/erpnext/selling/doctype/installation_note/test_installation_note.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('Installation Note') -class TestInstallationNote(unittest.TestCase): +class TestInstallationNote(IntegrationTestCase): pass diff --git a/erpnext/selling/doctype/sales_partner_type/test_sales_partner_type.py b/erpnext/selling/doctype/sales_partner_type/test_sales_partner_type.py index 04d40898254..8f35c48de0c 100644 --- a/erpnext/selling/doctype/sales_partner_type/test_sales_partner_type.py +++ b/erpnext/selling/doctype/sales_partner_type/test_sales_partner_type.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 TestSalesPartnerType(unittest.TestCase): + +class TestSalesPartnerType(IntegrationTestCase): pass diff --git a/erpnext/selling/doctype/selling_settings/test_selling_settings.py b/erpnext/selling/doctype/selling_settings/test_selling_settings.py index 7290e685b2f..91a73d92ec3 100644 --- a/erpnext/selling/doctype/selling_settings/test_selling_settings.py +++ b/erpnext/selling/doctype/selling_settings/test_selling_settings.py @@ -1,12 +1,12 @@ # Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase -class TestSellingSettings(unittest.TestCase): +class TestSellingSettings(IntegrationTestCase): def test_defaults_populated(self): # Setup default values are not populated on migrate, this test checks # if setup was completed correctly diff --git a/erpnext/setup/doctype/authorization_rule/test_authorization_rule.py b/erpnext/setup/doctype/authorization_rule/test_authorization_rule.py index 55c1bbb79b1..075dc77e3b4 100644 --- a/erpnext/setup/doctype/authorization_rule/test_authorization_rule.py +++ b/erpnext/setup/doctype/authorization_rule/test_authorization_rule.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('Authorization Rule') -class TestAuthorizationRule(unittest.TestCase): +class TestAuthorizationRule(IntegrationTestCase): pass diff --git a/erpnext/setup/doctype/company/test_company.py b/erpnext/setup/doctype/company/test_company.py index babd7dd4e84..08b43d8e97e 100644 --- a/erpnext/setup/doctype/company/test_company.py +++ b/erpnext/setup/doctype/company/test_company.py @@ -1,11 +1,11 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt - import json import unittest import frappe from frappe import _ +from frappe.tests import IntegrationTestCase from frappe.utils import random_string from erpnext.accounts.doctype.account.chart_of_accounts.chart_of_accounts import ( @@ -18,7 +18,7 @@ test_dependencies = ["Fiscal Year"] test_records = frappe.get_test_records("Company") -class TestCompany(unittest.TestCase): +class TestCompany(IntegrationTestCase): def test_coa_based_on_existing_company(self): company = frappe.new_doc("Company") company.company_name = "COA from Existing Company" diff --git a/erpnext/setup/doctype/currency_exchange/test_currency_exchange.py b/erpnext/setup/doctype/currency_exchange/test_currency_exchange.py index d28b1e65b7b..907ead78efa 100644 --- a/erpnext/setup/doctype/currency_exchange/test_currency_exchange.py +++ b/erpnext/setup/doctype/currency_exchange/test_currency_exchange.py @@ -1,10 +1,10 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt - import unittest from unittest import mock import frappe +from frappe.tests import IntegrationTestCase from frappe.utils import cint, flt from erpnext.setup.utils import get_exchange_rate @@ -80,7 +80,7 @@ def patched_requests_get(*args, **kwargs): @mock.patch("requests.get", side_effect=patched_requests_get) -class TestCurrencyExchange(unittest.TestCase): +class TestCurrencyExchange(IntegrationTestCase): def clear_cache(self): cache = frappe.cache() for date in test_exchange_values.keys(): diff --git a/erpnext/setup/doctype/department/test_department.py b/erpnext/setup/doctype/department/test_department.py index b8c043f0b2d..9dd2c0c7305 100644 --- a/erpnext/setup/doctype/department/test_department.py +++ b/erpnext/setup/doctype/department/test_department.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_ignore = ["Leave Block List"] -class TestDepartment(unittest.TestCase): +class TestDepartment(IntegrationTestCase): def test_remove_department_data(self): doc = create_department("Test Department") frappe.delete_doc("Department", doc.name) diff --git a/erpnext/setup/doctype/driver/test_driver.py b/erpnext/setup/doctype/driver/test_driver.py index 22707293a05..d75d7ab8977 100644 --- a/erpnext/setup/doctype/driver/test_driver.py +++ b/erpnext/setup/doctype/driver/test_driver.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 TestDriver(unittest.TestCase): + +class TestDriver(IntegrationTestCase): pass diff --git a/erpnext/setup/doctype/email_digest/test_email_digest.py b/erpnext/setup/doctype/email_digest/test_email_digest.py index dae28b81b5e..519735961d0 100644 --- a/erpnext/setup/doctype/email_digest/test_email_digest.py +++ b/erpnext/setup/doctype/email_digest/test_email_digest.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('Email Digest') -class TestEmailDigest(unittest.TestCase): +class TestEmailDigest(IntegrationTestCase): pass