refactor: Use IntegrationTestCase in multiple files

Signed-off-by: David <dgx.arnold@gmail.com>
This commit is contained in:
David
2024-10-08 02:13:00 +02:00
parent cd112795d3
commit 58c49dc9d2
42 changed files with 107 additions and 81 deletions

View File

@@ -1,10 +1,10 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import unittest
import frappe
import frappe.utils
from frappe.tests import IntegrationTestCase
import erpnext
from erpnext.setup.doctype.employee.employee import InactiveEmployeeStatusError
@@ -12,7 +12,7 @@ from erpnext.setup.doctype.employee.employee import InactiveEmployeeStatusError
test_records = frappe.get_test_records("Employee")
class TestEmployee(unittest.TestCase):
class TestEmployee(IntegrationTestCase):
def test_employee_status_left(self):
employee1 = make_employee("test_employee_1@company.com")
employee2 = make_employee("test_employee_2@company.com")

View File

@@ -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.setup.doctype.employee.test_employee import make_employee
class TestEmployeeGroup(unittest.TestCase):
class TestEmployeeGroup(IntegrationTestCase):
pass

View File

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

View File

@@ -1,17 +1,17 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import unittest
from contextlib import contextmanager
from datetime import date, timedelta
import frappe
from frappe.tests import IntegrationTestCase
from frappe.utils import getdate
from erpnext.setup.doctype.holiday_list.holiday_list import local_country_name
class TestHolidayList(unittest.TestCase):
class TestHolidayList(IntegrationTestCase):
def test_holiday_list(self):
today_date = getdate()
test_holiday_dates = [today_date - timedelta(days=5), today_date - timedelta(days=4)]

View File

@@ -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.nestedset import (
NestedSetChildExistsError,
NestedSetInvalidMergeError,
@@ -17,7 +16,7 @@ from frappe.utils.nestedset import (
test_records = frappe.get_test_records("Item Group")
class TestItem(unittest.TestCase):
class TestItem(IntegrationTestCase):
def test_basic_tree(self, records=None):
min_lft = 1
max_rgt = frappe.db.sql("select max(rgt) from `tabItem Group`")[0][0]

View File

@@ -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('Party Type')
class TestPartyType(unittest.TestCase):
class TestPartyType(IntegrationTestCase):
pass

View File

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

View File

@@ -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 import random_string
# test_records = frappe.get_test_records('Vehicle')
class TestVehicle(unittest.TestCase):
class TestVehicle(IntegrationTestCase):
def test_make_vehicle(self):
vehicle = frappe.get_doc(
{

View File

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

View File

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

View File

@@ -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 TestItemManufacturer(unittest.TestCase):
class TestItemManufacturer(IntegrationTestCase):
pass

View File

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

View File

@@ -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('Manufacturer')
class TestManufacturer(unittest.TestCase):
class TestManufacturer(IntegrationTestCase):
pass

View File

@@ -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 TestQualityInspectionParameter(unittest.TestCase):
class TestQualityInspectionParameter(IntegrationTestCase):
pass

View File

@@ -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 TestQualityInspectionParameterGroup(unittest.TestCase):
class TestQualityInspectionParameterGroup(IntegrationTestCase):
pass

View File

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

View File

@@ -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 TestShipmentParcelTemplate(unittest.TestCase):
class TestShipmentParcelTemplate(IntegrationTestCase):
pass

View File

@@ -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 TestStockEntryType(unittest.TestCase):
class TestStockEntryType(IntegrationTestCase):
def test_stock_entry_type_non_standard(self):
stock_entry_type = "Test Manufacturing"

View File

@@ -1,14 +1,14 @@
# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
import unittest
import frappe
from frappe.tests import IntegrationTestCase
from erpnext.stock.doctype.repost_item_valuation.repost_item_valuation import get_recipients
class TestStockRepostingSettings(unittest.TestCase):
class TestStockRepostingSettings(IntegrationTestCase):
def test_notify_reposting_error_to_role(self):
role = "Notify Reposting Role"

View File

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

View File

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

View File

@@ -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 TestWarehouseType(unittest.TestCase):
class TestWarehouseType(IntegrationTestCase):
pass

View File

@@ -1,6 +1,7 @@
import unittest
import frappe
from frappe.tests import IntegrationTestCase
from erpnext.tests.utils import ReportFilters, ReportName, execute_script_report
@@ -75,7 +76,7 @@ OPTIONAL_FILTERS = {
}
class TestReports(unittest.TestCase):
class TestReports(IntegrationTestCase):
def test_execute_all_stock_reports(self):
"""Test that all script report in stock modules are executable with supported filters"""
for report, filter in REPORT_FILTER_TEST_CASES:

View File

@@ -15,7 +15,7 @@ value_gen = st.floats(min_value=1, max_value=1e6)
stock_queue_generator = st.lists(st.tuples(qty_gen, value_gen), min_size=10)
class TestFIFOValuation(unittest.TestCase):
class TestFIFOValuation(IntegrationTestCase):
def setUp(self):
self.queue = FIFOValuation([])
@@ -195,7 +195,7 @@ class TestFIFOValuation(unittest.TestCase):
self.assertTotalValue(total_value)
class TestLIFOValuation(unittest.TestCase):
class TestLIFOValuation(IntegrationTestCase):
def setUp(self):
self.stack = LIFOValuation([])

View File

@@ -1,11 +1,11 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and Contributors
# See license.txt
import unittest
import frappe
from frappe import _
from frappe.core.doctype.user_permission.test_user_permission import create_user
from frappe.tests import IntegrationTestCase
from frappe.utils import flt, get_datetime
from erpnext.support.doctype.service_level_agreement.test_service_level_agreement import (
@@ -13,7 +13,7 @@ from erpnext.support.doctype.service_level_agreement.test_service_level_agreemen
)
class TestSetUp(unittest.TestCase):
class TestSetUp(IntegrationTestCase):
def setUp(self):
frappe.db.sql("delete from `tabService Level Agreement`")
frappe.db.sql("delete from `tabService Level Priority`")

View File

@@ -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 TestIssuePriority(unittest.TestCase):
class TestIssuePriority(IntegrationTestCase):
def test_priorities(self):
make_priorities()
priorities = frappe.get_list("Issue Priority")

View File

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

View File

@@ -1,10 +1,10 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
import datetime
import unittest
import frappe
from frappe.tests import IntegrationTestCase
from frappe.utils import flt
from erpnext.support.doctype.issue_priority.test_issue_priority import make_priorities
@@ -13,7 +13,7 @@ from erpnext.support.doctype.service_level_agreement.service_level_agreement imp
)
class TestServiceLevelAgreement(unittest.TestCase):
class TestServiceLevelAgreement(IntegrationTestCase):
def setUp(self):
self.create_company()
frappe.db.set_single_value("Support Settings", "track_service_level_agreement", 1)

View File

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

View File

@@ -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("Warranty Claim")
class TestWarrantyClaim(unittest.TestCase):
class TestWarrantyClaim(IntegrationTestCase):
pass

View File

@@ -2,6 +2,7 @@ import unittest
import frappe
from frappe.desk.form.assign_to import add as add_assignment
from frappe.tests import IntegrationTestCase
from frappe.utils import add_months, getdate
from erpnext.support.doctype.issue.test_issue import create_customer, make_issue
@@ -13,7 +14,7 @@ from erpnext.support.report.issue_analytics.issue_analytics import execute
months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
class TestIssueAnalytics(unittest.TestCase):
class TestIssueAnalytics(IntegrationTestCase):
@classmethod
def setUpClass(self):
frappe.db.sql("delete from `tabIssue` where company='_Test Company'")

View File

@@ -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 TestCallLog(unittest.TestCase):
class TestCallLog(IntegrationTestCase):
pass

View File

@@ -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 TestIncomingCallSettings(unittest.TestCase):
class TestIncomingCallSettings(IntegrationTestCase):
pass

View File

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

View File

@@ -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 TestVoiceCallSettings(unittest.TestCase):
class TestVoiceCallSettings(IntegrationTestCase):
pass

View File

@@ -1,13 +1,14 @@
import unittest
import frappe
from frappe.tests import IntegrationTestCase
from erpnext import encode_company_abbr
test_records = frappe.get_test_records("Company")
class TestInit(unittest.TestCase):
class TestInit(IntegrationTestCase):
def test_encode_company_abbr(self):
abbr = "NFECT"

View File

@@ -1,14 +1,13 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
import unittest
import frappe
from frappe.desk import notifications
from frappe.tests import IntegrationTestCase
class TestNotifications(unittest.TestCase):
class TestNotifications(IntegrationTestCase):
def test_get_notifications_for_targets(self):
"""
Test notification config entries for targets as percentages

View File

@@ -1,9 +1,9 @@
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
import unittest
import frappe
from frappe.tests import IntegrationTestCase
from erpnext.accounts.doctype.pos_profile.test_pos_profile import make_pos_profile
from erpnext.selling.page.point_of_sale.point_of_sale import get_items
@@ -11,7 +11,7 @@ from erpnext.stock.doctype.item.test_item import make_item
from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
class TestPointOfSale(unittest.TestCase):
class TestPointOfSale(IntegrationTestCase):
@classmethod
def setUpClass(cls) -> None:
frappe.db.savepoint("before_test_point_of_sale")

View File

@@ -1,6 +1,7 @@
import unittest
import frappe
from frappe.tests import IntegrationTestCase
import erpnext
@@ -10,7 +11,7 @@ def test_method():
return "original"
class TestInit(unittest.TestCase):
class TestInit(IntegrationTestCase):
def test_regional_overrides(self):
frappe.flags.country = "Maldives"
self.assertEqual(test_method(), "original")

View File

@@ -1,12 +1,13 @@
import unittest
import frappe
from frappe.tests import IntegrationTestCase
from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order
from erpnext.buying.doctype.supplier.test_supplier import create_supplier
class TestWebsite(unittest.TestCase):
class TestWebsite(IntegrationTestCase):
def test_permission_for_custom_doctype(self):
create_user("Supplier 1", "supplier1@gmail.com")
create_user("Supplier 2", "supplier2@gmail.com")

View File

@@ -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 TestVideo(unittest.TestCase):
class TestVideo(IntegrationTestCase):
pass

View File

@@ -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 TestVideoSettings(unittest.TestCase):
class TestVideoSettings(IntegrationTestCase):
pass