From d1fa1af27165f05c76bc91aea4783a373d4ab71f Mon Sep 17 00:00:00 2001 From: David Date: Tue, 8 Oct 2024 01:32:35 +0200 Subject: [PATCH] refactor: Use IntegrationTestCase in multiple files Signed-off-by: David --- .../doctype/plaid_settings/test_plaid_settings.py | 4 ++-- .../doctype/quickbooks_migrator/test_quickbooks_migrator.py | 5 +++-- .../doctype/tally_migration/test_tally_migration.py | 5 +++-- .../maintenance_schedule/test_maintenance_schedule.py | 4 ++-- .../doctype/maintenance_visit/test_maintenance_visit.py | 4 ++-- .../doctype/downtime_entry/test_downtime_entry.py | 5 +++-- .../manufacturing_settings/test_manufacturing_settings.py | 5 +++-- .../test_material_request_plan_item.py | 5 +++-- erpnext/manufacturing/doctype/operation/test_operation.py | 4 ++-- .../test_production_plan_material_request_warehouse.py | 5 +++-- .../doctype/sub_operation/test_sub_operation.py | 5 +++-- erpnext/manufacturing/report/test_reports.py | 3 ++- erpnext/projects/doctype/activity_cost/test_activity_cost.py | 4 ++-- .../doctype/project_template/test_project_template.py | 4 ++-- erpnext/projects/doctype/project_type/test_project_type.py | 5 +++-- .../projects/doctype/project_update/test_project_update.py | 4 ++-- .../doctype/projects_settings/test_projects_settings.py | 5 +++-- erpnext/projects/doctype/task/test_task.py | 3 ++- erpnext/projects/doctype/task_type/test_task_type.py | 5 +++-- erpnext/projects/doctype/timesheet/test_timesheet.py | 4 ++-- .../delayed_tasks_summary/test_delayed_tasks_summary.py | 3 ++- .../doctype/non_conformance/test_non_conformance.py | 5 +++-- 22 files changed, 55 insertions(+), 41 deletions(-) diff --git a/erpnext/erpnext_integrations/doctype/plaid_settings/test_plaid_settings.py b/erpnext/erpnext_integrations/doctype/plaid_settings/test_plaid_settings.py index 666def31d55..891a6bd10df 100644 --- a/erpnext/erpnext_integrations/doctype/plaid_settings/test_plaid_settings.py +++ b/erpnext/erpnext_integrations/doctype/plaid_settings/test_plaid_settings.py @@ -1,10 +1,10 @@ # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import json import unittest import frappe +from frappe.tests import IntegrationTestCase from frappe.utils.response import json_handler from erpnext.erpnext_integrations.doctype.plaid_settings.plaid_settings import ( @@ -16,7 +16,7 @@ from erpnext.erpnext_integrations.doctype.plaid_settings.plaid_settings import ( ) -class TestPlaidSettings(unittest.TestCase): +class TestPlaidSettings(IntegrationTestCase): def setUp(self): pass diff --git a/erpnext/erpnext_integrations/doctype/quickbooks_migrator/test_quickbooks_migrator.py b/erpnext/erpnext_integrations/doctype/quickbooks_migrator/test_quickbooks_migrator.py index 92e79ec8a4a..dd065a606ba 100644 --- a/erpnext/erpnext_integrations/doctype/quickbooks_migrator/test_quickbooks_migrator.py +++ b/erpnext/erpnext_integrations/doctype/quickbooks_migrator/test_quickbooks_migrator.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 TestQuickBooksMigrator(unittest.TestCase): + +class TestQuickBooksMigrator(IntegrationTestCase): pass diff --git a/erpnext/erpnext_integrations/doctype/tally_migration/test_tally_migration.py b/erpnext/erpnext_integrations/doctype/tally_migration/test_tally_migration.py index 7a61abaee63..62c52e51b31 100644 --- a/erpnext/erpnext_integrations/doctype/tally_migration/test_tally_migration.py +++ b/erpnext/erpnext_integrations/doctype/tally_migration/test_tally_migration.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 TestTallyMigration(unittest.TestCase): + +class TestTallyMigration(IntegrationTestCase): pass diff --git a/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py b/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py index 2268e0f7afa..256cd1271a6 100644 --- a/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py +++ b/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.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 format_date from frappe.utils.data import add_days, formatdate, today @@ -17,7 +17,7 @@ from erpnext.stock.doctype.stock_entry.test_stock_entry import make_serialized_i # test_records = frappe.get_test_records('Maintenance Schedule') -class TestMaintenanceSchedule(unittest.TestCase): +class TestMaintenanceSchedule(IntegrationTestCase): def test_events_should_be_created_and_deleted(self): ms = make_maintenance_schedule() ms.generate_schedule() diff --git a/erpnext/maintenance/doctype/maintenance_visit/test_maintenance_visit.py b/erpnext/maintenance/doctype/maintenance_visit/test_maintenance_visit.py index 9c868c471d0..fbdf247a5a5 100644 --- a/erpnext/maintenance/doctype/maintenance_visit/test_maintenance_visit.py +++ b/erpnext/maintenance/doctype/maintenance_visit/test_maintenance_visit.py @@ -1,15 +1,15 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase from frappe.utils.data import today # test_records = frappe.get_test_records('Maintenance Visit') -class TestMaintenanceVisit(unittest.TestCase): +class TestMaintenanceVisit(IntegrationTestCase): pass diff --git a/erpnext/manufacturing/doctype/downtime_entry/test_downtime_entry.py b/erpnext/manufacturing/doctype/downtime_entry/test_downtime_entry.py index 2f99a5cd112..b59b336c657 100644 --- a/erpnext/manufacturing/doctype/downtime_entry/test_downtime_entry.py +++ b/erpnext/manufacturing/doctype/downtime_entry/test_downtime_entry.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 TestDowntimeEntry(unittest.TestCase): + +class TestDowntimeEntry(IntegrationTestCase): pass diff --git a/erpnext/manufacturing/doctype/manufacturing_settings/test_manufacturing_settings.py b/erpnext/manufacturing/doctype/manufacturing_settings/test_manufacturing_settings.py index 1b2f18fc7ba..050b5d7d0f2 100644 --- a/erpnext/manufacturing/doctype/manufacturing_settings/test_manufacturing_settings.py +++ b/erpnext/manufacturing/doctype/manufacturing_settings/test_manufacturing_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 TestManufacturingSettings(unittest.TestCase): + +class TestManufacturingSettings(IntegrationTestCase): pass diff --git a/erpnext/manufacturing/doctype/material_request_plan_item/test_material_request_plan_item.py b/erpnext/manufacturing/doctype/material_request_plan_item/test_material_request_plan_item.py index 0654c1ebbbc..f903d2dce2d 100644 --- a/erpnext/manufacturing/doctype/material_request_plan_item/test_material_request_plan_item.py +++ b/erpnext/manufacturing/doctype/material_request_plan_item/test_material_request_plan_item.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 TestMaterialRequestPlanItem(unittest.TestCase): + +class TestMaterialRequestPlanItem(IntegrationTestCase): pass diff --git a/erpnext/manufacturing/doctype/operation/test_operation.py b/erpnext/manufacturing/doctype/operation/test_operation.py index ce9f8e06495..1e152980d08 100644 --- a/erpnext/manufacturing/doctype/operation/test_operation.py +++ b/erpnext/manufacturing/doctype/operation/test_operation.py @@ -1,14 +1,14 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase test_records = frappe.get_test_records("Operation") -class TestOperation(unittest.TestCase): +class TestOperation(IntegrationTestCase): pass diff --git a/erpnext/manufacturing/doctype/production_plan_material_request_warehouse/test_production_plan_material_request_warehouse.py b/erpnext/manufacturing/doctype/production_plan_material_request_warehouse/test_production_plan_material_request_warehouse.py index 4394c142d49..bab30fa6a92 100644 --- a/erpnext/manufacturing/doctype/production_plan_material_request_warehouse/test_production_plan_material_request_warehouse.py +++ b/erpnext/manufacturing/doctype/production_plan_material_request_warehouse/test_production_plan_material_request_warehouse.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 TestProductionPlanMaterialRequestWarehouse(unittest.TestCase): + +class TestProductionPlanMaterialRequestWarehouse(IntegrationTestCase): pass diff --git a/erpnext/manufacturing/doctype/sub_operation/test_sub_operation.py b/erpnext/manufacturing/doctype/sub_operation/test_sub_operation.py index 189fdaee085..05486e98777 100644 --- a/erpnext/manufacturing/doctype/sub_operation/test_sub_operation.py +++ b/erpnext/manufacturing/doctype/sub_operation/test_sub_operation.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 TestSubOperation(unittest.TestCase): + +class TestSubOperation(IntegrationTestCase): pass diff --git a/erpnext/manufacturing/report/test_reports.py b/erpnext/manufacturing/report/test_reports.py index 3e20f310ff9..afe3f0890e6 100644 --- a/erpnext/manufacturing/report/test_reports.py +++ b/erpnext/manufacturing/report/test_reports.py @@ -1,6 +1,7 @@ import unittest import frappe +from frappe.tests import IntegrationTestCase from erpnext.tests.utils import ReportFilters, ReportName, execute_script_report @@ -50,7 +51,7 @@ OPTIONAL_FILTERS = { } -class TestManufacturingReports(unittest.TestCase): +class TestManufacturingReports(IntegrationTestCase): def test_execute_all_manufacturing_reports(self): """Test that all script report in manufacturing modules are executable with supported filters""" for report, filter in REPORT_FILTER_TEST_CASES: diff --git a/erpnext/projects/doctype/activity_cost/test_activity_cost.py b/erpnext/projects/doctype/activity_cost/test_activity_cost.py index 8da797ed4f2..03db2fe6d5a 100644 --- a/erpnext/projects/doctype/activity_cost/test_activity_cost.py +++ b/erpnext/projects/doctype/activity_cost/test_activity_cost.py @@ -1,14 +1,14 @@ # 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.projects.doctype.activity_cost.activity_cost import DuplicationError -class TestActivityCost(unittest.TestCase): +class TestActivityCost(IntegrationTestCase): def test_duplication(self): frappe.db.sql("delete from `tabActivity Cost`") activity_cost1 = frappe.new_doc("Activity Cost") diff --git a/erpnext/projects/doctype/project_template/test_project_template.py b/erpnext/projects/doctype/project_template/test_project_template.py index 382ffd5aa4c..7d94e5226ca 100644 --- a/erpnext/projects/doctype/project_template/test_project_template.py +++ b/erpnext/projects/doctype/project_template/test_project_template.py @@ -1,14 +1,14 @@ # Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase from erpnext.projects.doctype.task.test_task import create_task -class TestProjectTemplate(unittest.TestCase): +class TestProjectTemplate(IntegrationTestCase): pass diff --git a/erpnext/projects/doctype/project_type/test_project_type.py b/erpnext/projects/doctype/project_type/test_project_type.py index 3e670d06bd5..31e0f840db3 100644 --- a/erpnext/projects/doctype/project_type/test_project_type.py +++ b/erpnext/projects/doctype/project_type/test_project_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 TestProjectType(unittest.TestCase): + +class TestProjectType(IntegrationTestCase): pass diff --git a/erpnext/projects/doctype/project_update/test_project_update.py b/erpnext/projects/doctype/project_update/test_project_update.py index 8663350c8f2..4f3a1862188 100644 --- a/erpnext/projects/doctype/project_update/test_project_update.py +++ b/erpnext/projects/doctype/project_update/test_project_update.py @@ -1,12 +1,12 @@ # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import unittest import frappe +from frappe.tests import IntegrationTestCase -class TestProjectUpdate(unittest.TestCase): +class TestProjectUpdate(IntegrationTestCase): pass diff --git a/erpnext/projects/doctype/projects_settings/test_projects_settings.py b/erpnext/projects/doctype/projects_settings/test_projects_settings.py index 79e78320bb4..06ecd2ad5dd 100644 --- a/erpnext/projects/doctype/projects_settings/test_projects_settings.py +++ b/erpnext/projects/doctype/projects_settings/test_projects_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 TestProjectsSettings(unittest.TestCase): + +class TestProjectsSettings(IntegrationTestCase): pass diff --git a/erpnext/projects/doctype/task/test_task.py b/erpnext/projects/doctype/task/test_task.py index 18dba7337f7..082b474c07a 100644 --- a/erpnext/projects/doctype/task/test_task.py +++ b/erpnext/projects/doctype/task/test_task.py @@ -3,12 +3,13 @@ import unittest import frappe +from frappe.tests import IntegrationTestCase from frappe.utils import add_days, getdate, nowdate from erpnext.projects.doctype.task.task import CircularReferenceError -class TestTask(unittest.TestCase): +class TestTask(IntegrationTestCase): def test_circular_reference(self): task1 = create_task("_Test Task 1", add_days(nowdate(), -15), add_days(nowdate(), -10)) task2 = create_task("_Test Task 2", add_days(nowdate(), 11), add_days(nowdate(), 15), task1.name) diff --git a/erpnext/projects/doctype/task_type/test_task_type.py b/erpnext/projects/doctype/task_type/test_task_type.py index ef99402f7ad..9f34e97592e 100644 --- a/erpnext/projects/doctype/task_type/test_task_type.py +++ b/erpnext/projects/doctype/task_type/test_task_type.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 TestTaskType(unittest.TestCase): + +class TestTaskType(IntegrationTestCase): pass diff --git a/erpnext/projects/doctype/timesheet/test_timesheet.py b/erpnext/projects/doctype/timesheet/test_timesheet.py index da042f36aef..ba2f95ba59b 100644 --- a/erpnext/projects/doctype/timesheet/test_timesheet.py +++ b/erpnext/projects/doctype/timesheet/test_timesheet.py @@ -1,10 +1,10 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt - import datetime import unittest import frappe +from frappe.tests import IntegrationTestCase from frappe.utils import add_to_date, now_datetime, nowdate from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice @@ -12,7 +12,7 @@ from erpnext.projects.doctype.timesheet.timesheet import OverlapError, make_sale from erpnext.setup.doctype.employee.test_employee import make_employee -class TestTimesheet(unittest.TestCase): +class TestTimesheet(IntegrationTestCase): def setUp(self): frappe.db.delete("Timesheet") diff --git a/erpnext/projects/report/delayed_tasks_summary/test_delayed_tasks_summary.py b/erpnext/projects/report/delayed_tasks_summary/test_delayed_tasks_summary.py index c288125ac11..20c74ef5e80 100644 --- a/erpnext/projects/report/delayed_tasks_summary/test_delayed_tasks_summary.py +++ b/erpnext/projects/report/delayed_tasks_summary/test_delayed_tasks_summary.py @@ -1,13 +1,14 @@ import unittest import frappe +from frappe.tests import IntegrationTestCase from frappe.utils import add_days, add_months, nowdate from erpnext.projects.doctype.task.test_task import create_task from erpnext.projects.report.delayed_tasks_summary.delayed_tasks_summary import execute -class TestDelayedTasksSummary(unittest.TestCase): +class TestDelayedTasksSummary(IntegrationTestCase): @classmethod def setUp(self): task1 = create_task("_Test Task 98", add_days(nowdate(), -10), nowdate()) diff --git a/erpnext/quality_management/doctype/non_conformance/test_non_conformance.py b/erpnext/quality_management/doctype/non_conformance/test_non_conformance.py index 3e94b35745c..68b6536cc18 100644 --- a/erpnext/quality_management/doctype/non_conformance/test_non_conformance.py +++ b/erpnext/quality_management/doctype/non_conformance/test_non_conformance.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 TestNonConformance(unittest.TestCase): + +class TestNonConformance(IntegrationTestCase): pass