Merge pull request #43547 from blaggacao/test-refactoring/batch-1728343954

Refactor: Use IntegrationTestCase in multiple files
This commit is contained in:
David Arnold
2024-10-08 01:52:45 +02:00
committed by GitHub
22 changed files with 55 additions and 41 deletions

View File

@@ -1,10 +1,10 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt # See license.txt
import json import json
import unittest import unittest
import frappe import frappe
from frappe.tests import IntegrationTestCase
from frappe.utils.response import json_handler from frappe.utils.response import json_handler
from erpnext.erpnext_integrations.doctype.plaid_settings.plaid_settings import ( 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): def setUp(self):
pass pass

View File

@@ -1,8 +1,9 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt # See license.txt
import unittest import unittest
from frappe.tests import IntegrationTestCase
class TestQuickBooksMigrator(unittest.TestCase):
class TestQuickBooksMigrator(IntegrationTestCase):
pass pass

View File

@@ -1,8 +1,9 @@
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt # See license.txt
import unittest import unittest
from frappe.tests import IntegrationTestCase
class TestTallyMigration(unittest.TestCase):
class TestTallyMigration(IntegrationTestCase):
pass pass

View File

@@ -1,9 +1,9 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt # See license.txt
import unittest import unittest
import frappe import frappe
from frappe.tests import IntegrationTestCase
from frappe.utils import format_date from frappe.utils import format_date
from frappe.utils.data import add_days, formatdate, today 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') # test_records = frappe.get_test_records('Maintenance Schedule')
class TestMaintenanceSchedule(unittest.TestCase): class TestMaintenanceSchedule(IntegrationTestCase):
def test_events_should_be_created_and_deleted(self): def test_events_should_be_created_and_deleted(self):
ms = make_maintenance_schedule() ms = make_maintenance_schedule()
ms.generate_schedule() ms.generate_schedule()

View File

@@ -1,15 +1,15 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt # See license.txt
import unittest import unittest
import frappe import frappe
from frappe.tests import IntegrationTestCase
from frappe.utils.data import today from frappe.utils.data import today
# test_records = frappe.get_test_records('Maintenance Visit') # test_records = frappe.get_test_records('Maintenance Visit')
class TestMaintenanceVisit(unittest.TestCase): class TestMaintenanceVisit(IntegrationTestCase):
pass pass

View File

@@ -1,9 +1,10 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt # See license.txt
# import frappe # import frappe
import unittest import unittest
from frappe.tests import IntegrationTestCase
class TestDowntimeEntry(unittest.TestCase):
class TestDowntimeEntry(IntegrationTestCase):
pass pass

View File

@@ -1,8 +1,9 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt # See license.txt
import unittest import unittest
from frappe.tests import IntegrationTestCase
class TestManufacturingSettings(unittest.TestCase):
class TestManufacturingSettings(IntegrationTestCase):
pass pass

View File

@@ -1,8 +1,9 @@
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt # See license.txt
import unittest import unittest
from frappe.tests import IntegrationTestCase
class TestMaterialRequestPlanItem(unittest.TestCase):
class TestMaterialRequestPlanItem(IntegrationTestCase):
pass pass

View File

@@ -1,14 +1,14 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt # See license.txt
import unittest import unittest
import frappe import frappe
from frappe.tests import IntegrationTestCase
test_records = frappe.get_test_records("Operation") test_records = frappe.get_test_records("Operation")
class TestOperation(unittest.TestCase): class TestOperation(IntegrationTestCase):
pass pass

View File

@@ -1,9 +1,10 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt # See license.txt
# import frappe # import frappe
import unittest import unittest
from frappe.tests import IntegrationTestCase
class TestProductionPlanMaterialRequestWarehouse(unittest.TestCase):
class TestProductionPlanMaterialRequestWarehouse(IntegrationTestCase):
pass pass

View File

@@ -1,9 +1,10 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt # See license.txt
# import frappe # import frappe
import unittest import unittest
from frappe.tests import IntegrationTestCase
class TestSubOperation(unittest.TestCase):
class TestSubOperation(IntegrationTestCase):
pass pass

View File

@@ -1,6 +1,7 @@
import unittest import unittest
import frappe import frappe
from frappe.tests import IntegrationTestCase
from erpnext.tests.utils import ReportFilters, ReportName, execute_script_report 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): def test_execute_all_manufacturing_reports(self):
"""Test that all script report in manufacturing modules are executable with supported filters""" """Test that all script report in manufacturing modules are executable with supported filters"""
for report, filter in REPORT_FILTER_TEST_CASES: for report, filter in REPORT_FILTER_TEST_CASES:

View File

@@ -1,14 +1,14 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and Contributors # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and Contributors
# See license.txt # See license.txt
import unittest import unittest
import frappe import frappe
from frappe.tests import IntegrationTestCase
from erpnext.projects.doctype.activity_cost.activity_cost import DuplicationError from erpnext.projects.doctype.activity_cost.activity_cost import DuplicationError
class TestActivityCost(unittest.TestCase): class TestActivityCost(IntegrationTestCase):
def test_duplication(self): def test_duplication(self):
frappe.db.sql("delete from `tabActivity Cost`") frappe.db.sql("delete from `tabActivity Cost`")
activity_cost1 = frappe.new_doc("Activity Cost") activity_cost1 = frappe.new_doc("Activity Cost")

View File

@@ -1,14 +1,14 @@
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt # See license.txt
import unittest import unittest
import frappe import frappe
from frappe.tests import IntegrationTestCase
from erpnext.projects.doctype.task.test_task import create_task from erpnext.projects.doctype.task.test_task import create_task
class TestProjectTemplate(unittest.TestCase): class TestProjectTemplate(IntegrationTestCase):
pass pass

View File

@@ -1,8 +1,9 @@
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt # See license.txt
import unittest import unittest
from frappe.tests import IntegrationTestCase
class TestProjectType(unittest.TestCase):
class TestProjectType(IntegrationTestCase):
pass pass

View File

@@ -1,12 +1,12 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt # See license.txt
import unittest import unittest
import frappe import frappe
from frappe.tests import IntegrationTestCase
class TestProjectUpdate(unittest.TestCase): class TestProjectUpdate(IntegrationTestCase):
pass pass

View File

@@ -1,8 +1,9 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt # See license.txt
import unittest import unittest
from frappe.tests import IntegrationTestCase
class TestProjectsSettings(unittest.TestCase):
class TestProjectsSettings(IntegrationTestCase):
pass pass

View File

@@ -3,12 +3,13 @@
import unittest import unittest
import frappe import frappe
from frappe.tests import IntegrationTestCase
from frappe.utils import add_days, getdate, nowdate from frappe.utils import add_days, getdate, nowdate
from erpnext.projects.doctype.task.task import CircularReferenceError from erpnext.projects.doctype.task.task import CircularReferenceError
class TestTask(unittest.TestCase): class TestTask(IntegrationTestCase):
def test_circular_reference(self): def test_circular_reference(self):
task1 = create_task("_Test Task 1", add_days(nowdate(), -15), add_days(nowdate(), -10)) 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) task2 = create_task("_Test Task 2", add_days(nowdate(), 11), add_days(nowdate(), 15), task1.name)

View File

@@ -1,8 +1,9 @@
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt # See license.txt
import unittest import unittest
from frappe.tests import IntegrationTestCase
class TestTaskType(unittest.TestCase):
class TestTaskType(IntegrationTestCase):
pass pass

View File

@@ -1,10 +1,10 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt # See license.txt
import datetime import datetime
import unittest import unittest
import frappe import frappe
from frappe.tests import IntegrationTestCase
from frappe.utils import add_to_date, now_datetime, nowdate from frappe.utils import add_to_date, now_datetime, nowdate
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice 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 from erpnext.setup.doctype.employee.test_employee import make_employee
class TestTimesheet(unittest.TestCase): class TestTimesheet(IntegrationTestCase):
def setUp(self): def setUp(self):
frappe.db.delete("Timesheet") frappe.db.delete("Timesheet")

View File

@@ -1,13 +1,14 @@
import unittest import unittest
import frappe import frappe
from frappe.tests import IntegrationTestCase
from frappe.utils import add_days, add_months, nowdate from frappe.utils import add_days, add_months, nowdate
from erpnext.projects.doctype.task.test_task import create_task from erpnext.projects.doctype.task.test_task import create_task
from erpnext.projects.report.delayed_tasks_summary.delayed_tasks_summary import execute from erpnext.projects.report.delayed_tasks_summary.delayed_tasks_summary import execute
class TestDelayedTasksSummary(unittest.TestCase): class TestDelayedTasksSummary(IntegrationTestCase):
@classmethod @classmethod
def setUp(self): def setUp(self):
task1 = create_task("_Test Task 98", add_days(nowdate(), -10), nowdate()) task1 = create_task("_Test Task 98", add_days(nowdate(), -10), nowdate())

View File

@@ -1,9 +1,10 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt # See license.txt
# import frappe # import frappe
import unittest import unittest
from frappe.tests import IntegrationTestCase
class TestNonConformance(unittest.TestCase):
class TestNonConformance(IntegrationTestCase):
pass pass