Merge branch 'develop' into payment-request-fixes

This commit is contained in:
Abdeali Chharchhoda
2024-10-07 19:12:29 +05:30
142 changed files with 1193 additions and 387 deletions

View File

@@ -5,7 +5,7 @@
import unittest import unittest
import frappe import frappe
from frappe.test_runner import make_test_records from frappe.tests.utils import make_test_records
from frappe.utils import nowdate from frappe.utils import nowdate
from erpnext.accounts.doctype.account.account import ( from erpnext.accounts.doctype.account.account import (

View File

@@ -2,8 +2,17 @@
# See license.txt # See license.txt
# import frappe # import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
class TestAccountClosingBalance(FrappeTestCase): class UnitTestAccountClosingBalance(UnitTestCase):
"""
Unit tests for AccountClosingBalance.
Use this class for testing individual functions and methods.
"""
pass
class TestAccountClosingBalance(IntegrationTestCase):
pass pass

View File

@@ -4,7 +4,7 @@
import frappe import frappe
from frappe import qb from frappe import qb
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase
from frappe.utils import add_days, today from frappe.utils import add_days, today
from erpnext.accounts.doctype.bank_reconciliation_tool.bank_reconciliation_tool import ( from erpnext.accounts.doctype.bank_reconciliation_tool.bank_reconciliation_tool import (
@@ -15,7 +15,7 @@ from erpnext.accounts.doctype.payment_entry.test_payment_entry import create_pay
from erpnext.accounts.test.accounts_mixin import AccountsTestMixin from erpnext.accounts.test.accounts_mixin import AccountsTestMixin
class TestBankReconciliationTool(AccountsTestMixin, FrappeTestCase): class TestBankReconciliationTool(AccountsTestMixin, IntegrationTestCase):
def setUp(self): def setUp(self):
self.create_company() self.create_company()
self.create_customer() self.create_customer()

View File

@@ -2,13 +2,22 @@
# License: GNU General Public License v3. See license.txt # License: GNU General Public License v3. See license.txt
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
from frappe.utils import nowdate from frappe.utils import nowdate
from erpnext.accounts.doctype.bank_transaction.test_bank_transaction import create_bank_account from erpnext.accounts.doctype.bank_transaction.test_bank_transaction import create_bank_account
class TestAutoMatchParty(FrappeTestCase): class UnitTestBankTransaction(UnitTestCase):
"""
Unit tests for BankTransaction.
Use this class for testing individual functions and methods.
"""
pass
class TestAutoMatchParty(IntegrationTestCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
create_bank_account() create_bank_account()

View File

@@ -6,7 +6,7 @@ import json
import frappe import frappe
from frappe import utils from frappe import utils
from frappe.model.docstatus import DocStatus from frappe.model.docstatus import DocStatus
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
from erpnext.accounts.doctype.bank_reconciliation_tool.bank_reconciliation_tool import ( from erpnext.accounts.doctype.bank_reconciliation_tool.bank_reconciliation_tool import (
get_linked_payments, get_linked_payments,
@@ -21,7 +21,16 @@ from erpnext.tests.utils import if_lending_app_installed
test_dependencies = ["Item", "Cost Center"] test_dependencies = ["Item", "Cost Center"]
class TestBankTransaction(FrappeTestCase): class UnitTestBankTransaction(UnitTestCase):
"""
Unit tests for BankTransaction.
Use this class for testing individual functions and methods.
"""
pass
class TestBankTransaction(IntegrationTestCase):
def setUp(self): def setUp(self):
for dt in [ for dt in [
"Bank Transaction", "Bank Transaction",

View File

@@ -2,8 +2,17 @@
# See license.txt # See license.txt
# import frappe # import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
class TestBisectAccountingStatements(FrappeTestCase): class UnitTestBisectAccountingStatements(UnitTestCase):
"""
Unit tests for BisectAccountingStatements.
Use this class for testing individual functions and methods.
"""
pass
class TestBisectAccountingStatements(IntegrationTestCase):
pass pass

View File

@@ -2,8 +2,17 @@
# See license.txt # See license.txt
# import frappe # import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
class TestBisectNodes(FrappeTestCase): class UnitTestBisectNodes(UnitTestCase):
"""
Unit tests for BisectNodes.
Use this class for testing individual functions and methods.
"""
pass
class TestBisectNodes(IntegrationTestCase):
pass pass

View File

@@ -1,7 +1,7 @@
# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt # See license.txt
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
from frappe.utils import add_days, nowdate, today from frappe.utils import add_days, nowdate, today
from erpnext import get_default_cost_center from erpnext import get_default_cost_center
@@ -19,7 +19,16 @@ from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import (
test_dependencies = ["Company", "Cost Center"] test_dependencies = ["Company", "Cost Center"]
class TestDunning(FrappeTestCase): class UnitTestDunning(UnitTestCase):
"""
Unit tests for Dunning.
Use this class for testing individual functions and methods.
"""
pass
class TestDunning(IntegrationTestCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super().setUpClass() super().setUpClass()

View File

@@ -3,7 +3,7 @@
import frappe import frappe
from frappe.tests.utils import FrappeTestCase, change_settings from frappe.tests import IntegrationTestCase
from frappe.utils import add_days, flt, today from frappe.utils import add_days, flt, today
from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry
@@ -11,7 +11,7 @@ from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sal
from erpnext.accounts.test.accounts_mixin import AccountsTestMixin from erpnext.accounts.test.accounts_mixin import AccountsTestMixin
class TestExchangeRateRevaluation(AccountsTestMixin, FrappeTestCase): class TestExchangeRateRevaluation(AccountsTestMixin, IntegrationTestCase):
def setUp(self): def setUp(self):
self.create_company() self.create_company()
self.create_usd_receivable_account() self.create_usd_receivable_account()
@@ -35,7 +35,7 @@ class TestExchangeRateRevaluation(AccountsTestMixin, FrappeTestCase):
company_doc.unrealized_exchange_gain_loss_account = company_doc.exchange_gain_loss_account company_doc.unrealized_exchange_gain_loss_account = company_doc.exchange_gain_loss_account
company_doc.save() company_doc.save()
@change_settings( @IntegrationTestCase.change_settings(
"Accounts Settings", "Accounts Settings",
{"allow_multi_currency_invoices_against_single_party_account": 1, "allow_stale": 0}, {"allow_multi_currency_invoices_against_single_party_account": 1, "allow_stale": 0},
) )
@@ -88,7 +88,7 @@ class TestExchangeRateRevaluation(AccountsTestMixin, FrappeTestCase):
)[0] )[0]
self.assertEqual(acc_balance.balance, 8500.0) self.assertEqual(acc_balance.balance, 8500.0)
@change_settings( @IntegrationTestCase.change_settings(
"Accounts Settings", "Accounts Settings",
{"allow_multi_currency_invoices_against_single_party_account": 1, "allow_stale": 0}, {"allow_multi_currency_invoices_against_single_party_account": 1, "allow_stale": 0},
) )
@@ -158,7 +158,7 @@ class TestExchangeRateRevaluation(AccountsTestMixin, FrappeTestCase):
self.assertEqual(acc_balance.balance, 0.0) self.assertEqual(acc_balance.balance, 0.0)
self.assertEqual(acc_balance.balance_in_account_currency, 0.0) self.assertEqual(acc_balance.balance_in_account_currency, 0.0)
@change_settings( @IntegrationTestCase.change_settings(
"Accounts Settings", "Accounts Settings",
{"allow_multi_currency_invoices_against_single_party_account": 1, "allow_stale": 0}, {"allow_multi_currency_invoices_against_single_party_account": 1, "allow_stale": 0},
) )
@@ -247,7 +247,7 @@ class TestExchangeRateRevaluation(AccountsTestMixin, FrappeTestCase):
self.assertEqual(flt(acc_balance.balance, precision), 0.0) self.assertEqual(flt(acc_balance.balance, precision), 0.0)
self.assertEqual(flt(acc_balance.balance_in_account_currency, precision), 0.0) self.assertEqual(flt(acc_balance.balance_in_account_currency, precision), 0.0)
@change_settings( @IntegrationTestCase.change_settings(
"Accounts Settings", "Accounts Settings",
{"allow_multi_currency_invoices_against_single_party_account": 1, "allow_stale": 0}, {"allow_multi_currency_invoices_against_single_party_account": 1, "allow_stale": 0},
) )

View File

@@ -1,10 +1,8 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt # License: GNU General Public License v3. See license.txt
import unittest
import frappe import frappe
from frappe.tests import IntegrationTestCase, UnitTestCase
from frappe.tests.utils import change_settings from frappe.tests.utils import change_settings
from frappe.utils import flt, nowdate from frappe.utils import flt, nowdate
@@ -13,8 +11,19 @@ from erpnext.accounts.doctype.journal_entry.journal_entry import StockAccountInv
from erpnext.exceptions import InvalidAccountCurrency from erpnext.exceptions import InvalidAccountCurrency
class TestJournalEntry(unittest.TestCase): class UnitTestJournalEntry(UnitTestCase):
@change_settings("Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1}) """
Unit tests for JournalEntry.
Use this class for testing individual functions and methods.
"""
pass
class TestJournalEntry(IntegrationTestCase):
@IntegrationTestCase.change_settings(
"Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1}
)
def test_journal_entry_with_against_jv(self): def test_journal_entry_with_against_jv(self):
jv_invoice = frappe.copy_doc(test_records[2]) jv_invoice = frappe.copy_doc(test_records[2])
base_jv = frappe.copy_doc(test_records[0]) base_jv = frappe.copy_doc(test_records[0])

View File

@@ -3,14 +3,14 @@
import frappe import frappe
from frappe import qb from frappe import qb
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase
from frappe.utils import nowdate from frappe.utils import nowdate
from erpnext.accounts.test.accounts_mixin import AccountsTestMixin from erpnext.accounts.test.accounts_mixin import AccountsTestMixin
from erpnext.accounts.utils import run_ledger_health_checks from erpnext.accounts.utils import run_ledger_health_checks
class TestLedgerHealth(AccountsTestMixin, FrappeTestCase): class TestLedgerHealth(AccountsTestMixin, IntegrationTestCase):
def setUp(self): def setUp(self):
self.create_company() self.create_company()
self.create_customer() self.create_customer()

View File

@@ -2,8 +2,17 @@
# See license.txt # See license.txt
# import frappe # import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
class TestLedgerHealthMonitor(FrappeTestCase): class UnitTestLedgerHealthMonitor(UnitTestCase):
"""
Unit tests for LedgerHealthMonitor.
Use this class for testing individual functions and methods.
"""
pass
class TestLedgerHealthMonitor(IntegrationTestCase):
pass pass

View File

@@ -2,7 +2,7 @@
# See license.txt # See license.txt
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
from erpnext.accounts.doctype.accounting_dimension.test_accounting_dimension import ( from erpnext.accounts.doctype.accounting_dimension.test_accounting_dimension import (
create_dimension, create_dimension,
@@ -15,7 +15,16 @@ from erpnext.accounts.doctype.opening_invoice_creation_tool.opening_invoice_crea
test_dependencies = ["Customer", "Supplier", "Accounting Dimension"] test_dependencies = ["Customer", "Supplier", "Accounting Dimension"]
class TestOpeningInvoiceCreationTool(FrappeTestCase): class UnitTestOpeningInvoiceCreationTool(UnitTestCase):
"""
Unit tests for OpeningInvoiceCreationTool.
Use this class for testing individual functions and methods.
"""
pass
class TestOpeningInvoiceCreationTool(IntegrationTestCase):
@classmethod @classmethod
def setUpClass(self): def setUpClass(self):
if not frappe.db.exists("Company", "_Test Opening Invoice Company"): if not frappe.db.exists("Company", "_Test Opening Invoice Company"):

View File

@@ -4,7 +4,7 @@
import frappe import frappe
from frappe import qb from frappe import qb
from frappe.tests.utils import FrappeTestCase, change_settings from frappe.tests import IntegrationTestCase, UnitTestCase
from frappe.utils import add_days, flt, nowdate from frappe.utils import add_days, flt, nowdate
from erpnext.accounts.doctype.account.test_account import create_account from erpnext.accounts.doctype.account.test_account import create_account
@@ -28,7 +28,16 @@ from erpnext.setup.doctype.employee.test_employee import make_employee
test_dependencies = ["Item"] test_dependencies = ["Item"]
class TestPaymentEntry(FrappeTestCase): class UnitTestPaymentEntry(UnitTestCase):
"""
Unit tests for PaymentEntry.
Use this class for testing individual functions and methods.
"""
pass
class TestPaymentEntry(IntegrationTestCase):
def tearDown(self): def tearDown(self):
frappe.db.rollback() frappe.db.rollback()
@@ -383,7 +392,7 @@ class TestPaymentEntry(FrappeTestCase):
self.assertEqual(si.payment_schedule[0].outstanding, 0) self.assertEqual(si.payment_schedule[0].outstanding, 0)
self.assertEqual(si.payment_schedule[0].discounted_amount, 50) self.assertEqual(si.payment_schedule[0].discounted_amount, 50)
@change_settings( @IntegrationTestCase.change_settings(
"Accounts Settings", "Accounts Settings",
{ {
"allow_multi_currency_invoices_against_single_party_account": 1, "allow_multi_currency_invoices_against_single_party_account": 1,
@@ -1090,7 +1099,7 @@ class TestPaymentEntry(FrappeTestCase):
} }
self.assertDictEqual(ref_details, expected_response) self.assertDictEqual(ref_details, expected_response)
@change_settings( @IntegrationTestCase.change_settings(
"Accounts Settings", "Accounts Settings",
{ {
"unlink_payment_on_cancellation_of_invoice": 1, "unlink_payment_on_cancellation_of_invoice": 1,
@@ -1185,7 +1194,7 @@ class TestPaymentEntry(FrappeTestCase):
si3.cancel() si3.cancel()
si3.delete() si3.delete()
@change_settings( @IntegrationTestCase.change_settings(
"Accounts Settings", "Accounts Settings",
{ {
"unlink_payment_on_cancellation_of_invoice": 1, "unlink_payment_on_cancellation_of_invoice": 1,
@@ -1791,7 +1800,7 @@ class TestPaymentEntry(FrappeTestCase):
# 'Is Opening' should always be 'No' for normal advance payments # 'Is Opening' should always be 'No' for normal advance payments
self.assertEqual(gl_with_opening_set, []) self.assertEqual(gl_with_opening_set, [])
@change_settings("Accounts Settings", {"delete_linked_ledger_entries": 1}) @IntegrationTestCase.change_settings("Accounts Settings", {"delete_linked_ledger_entries": 1})
def test_delete_linked_exchange_gain_loss_journal(self): def test_delete_linked_exchange_gain_loss_journal(self):
from erpnext.accounts.doctype.account.test_account import create_account from erpnext.accounts.doctype.account.test_account import create_account
from erpnext.accounts.doctype.opening_invoice_creation_tool.test_opening_invoice_creation_tool import ( from erpnext.accounts.doctype.opening_invoice_creation_tool.test_opening_invoice_creation_tool import (

View File

@@ -3,7 +3,7 @@
import frappe import frappe
from frappe import qb from frappe import qb
from frappe.tests.utils import FrappeTestCase, change_settings from frappe.tests import IntegrationTestCase, UnitTestCase
from frappe.utils import nowdate from frappe.utils import nowdate
from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry
@@ -13,7 +13,16 @@ from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_orde
from erpnext.stock.doctype.item.test_item import create_item from erpnext.stock.doctype.item.test_item import create_item
class TestPaymentLedgerEntry(FrappeTestCase): class UnitTestPaymentLedgerEntry(UnitTestCase):
"""
Unit tests for PaymentLedgerEntry.
Use this class for testing individual functions and methods.
"""
pass
class TestPaymentLedgerEntry(IntegrationTestCase):
def setUp(self): def setUp(self):
self.ple = qb.DocType("Payment Ledger Entry") self.ple = qb.DocType("Payment Ledger Entry")
self.create_company() self.create_company()
@@ -445,7 +454,7 @@ class TestPaymentLedgerEntry(FrappeTestCase):
self.assertEqual(pl_entries_for_crnote[0], expected_values[0]) self.assertEqual(pl_entries_for_crnote[0], expected_values[0])
self.assertEqual(pl_entries_for_crnote[1], expected_values[1]) self.assertEqual(pl_entries_for_crnote[1], expected_values[1])
@change_settings( @IntegrationTestCase.change_settings(
"Accounts Settings", "Accounts Settings",
{"unlink_payment_on_cancellation_of_invoice": 1, "delete_linked_ledger_entries": 1}, {"unlink_payment_on_cancellation_of_invoice": 1, "delete_linked_ledger_entries": 1},
) )
@@ -474,7 +483,7 @@ class TestPaymentLedgerEntry(FrappeTestCase):
si.delete() si.delete()
self.assertRaises(frappe.DoesNotExistError, frappe.get_doc, si.doctype, si.name) self.assertRaises(frappe.DoesNotExistError, frappe.get_doc, si.doctype, si.name)
@change_settings( @IntegrationTestCase.change_settings(
"Accounts Settings", "Accounts Settings",
{"unlink_payment_on_cancellation_of_invoice": 1, "delete_linked_ledger_entries": 1}, {"unlink_payment_on_cancellation_of_invoice": 1, "delete_linked_ledger_entries": 1},
) )
@@ -507,7 +516,7 @@ class TestPaymentLedgerEntry(FrappeTestCase):
si.delete() si.delete()
self.assertRaises(frappe.DoesNotExistError, frappe.get_doc, si.doctype, si.name) self.assertRaises(frappe.DoesNotExistError, frappe.get_doc, si.doctype, si.name)
@change_settings( @IntegrationTestCase.change_settings(
"Accounts Settings", "Accounts Settings",
{ {
"unlink_payment_on_cancellation_of_invoice": 1, "unlink_payment_on_cancellation_of_invoice": 1,

View File

@@ -3,7 +3,7 @@
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
from frappe.utils import getdate from frappe.utils import getdate
from erpnext.accounts.doctype.bank_transaction.test_bank_transaction import ( from erpnext.accounts.doctype.bank_transaction.test_bank_transaction import (
@@ -17,7 +17,16 @@ from erpnext.accounts.doctype.payment_entry.payment_entry import (
from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice
class TestPaymentOrder(FrappeTestCase): class UnitTestPaymentOrder(UnitTestCase):
"""
Unit tests for PaymentOrder.
Use this class for testing individual functions and methods.
"""
pass
class TestPaymentOrder(IntegrationTestCase):
def setUp(self): def setUp(self):
# generate and use a uniq hash identifier for 'Bank Account' and it's linked GL 'Account' to avoid validation error # generate and use a uniq hash identifier for 'Bank Account' and it's linked GL 'Account' to avoid validation error
uniq_identifier = frappe.generate_hash(length=10) uniq_identifier = frappe.generate_hash(length=10)

View File

@@ -4,7 +4,7 @@
import frappe import frappe
from frappe import qb from frappe import qb
from frappe.tests.utils import FrappeTestCase, change_settings from frappe.tests import IntegrationTestCase, UnitTestCase
from frappe.utils import add_days, add_years, flt, getdate, nowdate, today from frappe.utils import add_days, add_years, flt, getdate, nowdate, today
from erpnext import get_default_cost_center from erpnext import get_default_cost_center
@@ -20,7 +20,16 @@ from erpnext.stock.doctype.item.test_item import create_item
test_dependencies = ["Item"] test_dependencies = ["Item"]
class TestPaymentReconciliation(FrappeTestCase): class UnitTestPaymentReconciliation(UnitTestCase):
"""
Unit tests for PaymentReconciliation.
Use this class for testing individual functions and methods.
"""
pass
class TestPaymentReconciliation(IntegrationTestCase):
def setUp(self): def setUp(self):
self.create_company() self.create_company()
self.create_item() self.create_item()
@@ -1104,7 +1113,7 @@ class TestPaymentReconciliation(FrappeTestCase):
payment_vouchers = [x.get("reference_name") for x in pr.get("payments")] payment_vouchers = [x.get("reference_name") for x in pr.get("payments")]
self.assertCountEqual(payment_vouchers, [je2.name, pe2.name]) self.assertCountEqual(payment_vouchers, [je2.name, pe2.name])
@change_settings( @IntegrationTestCase.change_settings(
"Accounts Settings", "Accounts Settings",
{ {
"allow_multi_currency_invoices_against_single_party_account": 1, "allow_multi_currency_invoices_against_single_party_account": 1,

View File

@@ -6,7 +6,7 @@ import unittest
from unittest.mock import patch from unittest.mock import patch
import frappe import frappe
from frappe.tests.utils import FrappeTestCase, change_settings from frappe.tests import IntegrationTestCase, UnitTestCase
from erpnext.accounts.doctype.payment_entry.test_payment_entry import create_payment_terms_template from erpnext.accounts.doctype.payment_entry.test_payment_entry import create_payment_terms_template
from erpnext.accounts.doctype.payment_request.payment_request import make_payment_request from erpnext.accounts.doctype.payment_request.payment_request import make_payment_request
@@ -57,7 +57,16 @@ payment_method = [
] ]
class TestPaymentRequest(FrappeTestCase): class UnitTestPaymentRequest(UnitTestCase):
"""
Unit tests for PaymentRequest.
Use this class for testing individual functions and methods.
"""
pass
class TestPaymentRequest(IntegrationTestCase):
def setUp(self): def setUp(self):
for payment_gateway in payment_gateways: for payment_gateway in payment_gateways:
if not frappe.db.get_value("Payment Gateway", payment_gateway["gateway"], "name"): if not frappe.db.get_value("Payment Gateway", payment_gateway["gateway"], "name"):
@@ -218,7 +227,7 @@ class TestPaymentRequest(FrappeTestCase):
def test_payment_entry_against_purchase_invoice(self): def test_payment_entry_against_purchase_invoice(self):
si_usd = make_purchase_invoice( si_usd = make_purchase_invoice(
customer="_Test Supplier USD", supplier="_Test Supplier USD",
debit_to="_Test Payable USD - _TC", debit_to="_Test Payable USD - _TC",
currency="USD", currency="USD",
conversion_rate=50, conversion_rate=50,
@@ -243,7 +252,7 @@ class TestPaymentRequest(FrappeTestCase):
def test_multiple_payment_entry_against_purchase_invoice(self): def test_multiple_payment_entry_against_purchase_invoice(self):
purchase_invoice = make_purchase_invoice( purchase_invoice = make_purchase_invoice(
customer="_Test Supplier USD", supplier="_Test Supplier USD",
debit_to="_Test Payable USD - _TC", debit_to="_Test Payable USD - _TC",
currency="USD", currency="USD",
conversion_rate=50, conversion_rate=50,
@@ -483,7 +492,9 @@ class TestPaymentRequest(FrappeTestCase):
return_doc=1, return_doc=1,
) )
@change_settings("Accounts Settings", {"allow_multi_currency_invoices_against_single_party_account": 1}) @IntegrationTestCase.change_settings(
"Accounts Settings", allow_multi_currency_invoices_against_single_party_account=1
)
def test_multiple_payment_if_partially_paid_for_multi_currency(self): def test_multiple_payment_if_partially_paid_for_multi_currency(self):
pi = make_purchase_invoice(currency="USD", conversion_rate=50, qty=1, rate=100, do_not_save=1) pi = make_purchase_invoice(currency="USD", conversion_rate=50, qty=1, rate=100, do_not_save=1)
pi.credit_to = "Creditors - _TC" pi.credit_to = "Creditors - _TC"

View File

@@ -2,9 +2,9 @@
# See license.txt # See license.txt
import json import json
import unittest
import frappe import frappe
from frappe.tests import IntegrationTestCase, UnitTestCase
from frappe.tests.utils import change_settings from frappe.tests.utils import change_settings
from erpnext.accounts.doctype.pos_closing_entry.test_pos_closing_entry import init_user_and_profile from erpnext.accounts.doctype.pos_closing_entry.test_pos_closing_entry import init_user_and_profile
@@ -19,7 +19,16 @@ 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 from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
class TestPOSInvoiceMergeLog(unittest.TestCase): class UnitTestPosInvoiceMergeLog(UnitTestCase):
"""
Unit tests for PosInvoiceMergeLog.
Use this class for testing individual functions and methods.
"""
pass
class TestPOSInvoiceMergeLog(IntegrationTestCase):
def test_consolidated_invoice_creation(self): def test_consolidated_invoice_creation(self):
frappe.db.sql("delete from `tabPOS Invoice`") frappe.db.sql("delete from `tabPOS Invoice`")
@@ -288,7 +297,7 @@ class TestPOSInvoiceMergeLog(unittest.TestCase):
frappe.db.sql("delete from `tabPOS Profile`") frappe.db.sql("delete from `tabPOS Profile`")
frappe.db.sql("delete from `tabPOS Invoice`") frappe.db.sql("delete from `tabPOS Invoice`")
@change_settings( @IntegrationTestCase.change_settings(
"System Settings", {"number_format": "#,###.###", "currency_precision": 3, "float_precision": 3} "System Settings", {"number_format": "#,###.###", "currency_precision": 3, "float_precision": 3}
) )
def test_consolidation_round_off_error_3(self): def test_consolidation_round_off_error_3(self):

View File

@@ -5,7 +5,7 @@
import unittest import unittest
import frappe import frappe
from frappe.tests.utils import FrappeTestCase, change_settings from frappe.tests import IntegrationTestCase, UnitTestCase
from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice
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
@@ -15,7 +15,16 @@ from erpnext.stock.doctype.item.test_item import make_item
from erpnext.stock.get_item_details import get_item_details from erpnext.stock.get_item_details import get_item_details
class TestPricingRule(FrappeTestCase): class UnitTestPricingRule(UnitTestCase):
"""
Unit tests for PricingRule.
Use this class for testing individual functions and methods.
"""
pass
class TestPricingRule(IntegrationTestCase):
def setUp(self): def setUp(self):
delete_existing_pricing_rules() delete_existing_pricing_rules()
setup_pricing_rule_data() setup_pricing_rule_data()

View File

@@ -2,8 +2,17 @@
# See license.txt # See license.txt
# import frappe # import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
class TestProcessPaymentReconciliation(FrappeTestCase): class UnitTestProcessPaymentReconciliation(UnitTestCase):
"""
Unit tests for ProcessPaymentReconciliation.
Use this class for testing individual functions and methods.
"""
pass
class TestProcessPaymentReconciliation(IntegrationTestCase):
pass pass

View File

@@ -2,8 +2,17 @@
# See license.txt # See license.txt
# import frappe # import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
class TestProcessPaymentReconciliationLog(FrappeTestCase): class UnitTestProcessPaymentReconciliationLog(UnitTestCase):
"""
Unit tests for ProcessPaymentReconciliationLog.
Use this class for testing individual functions and methods.
"""
pass
class TestProcessPaymentReconciliationLog(IntegrationTestCase):
pass pass

View File

@@ -3,7 +3,7 @@
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase
from frappe.utils import add_days, getdate, today from frappe.utils import add_days, getdate, today
from erpnext.accounts.doctype.process_statement_of_accounts.process_statement_of_accounts import ( from erpnext.accounts.doctype.process_statement_of_accounts.process_statement_of_accounts import (
@@ -14,7 +14,7 @@ from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sal
from erpnext.accounts.test.accounts_mixin import AccountsTestMixin from erpnext.accounts.test.accounts_mixin import AccountsTestMixin
class TestProcessStatementOfAccounts(AccountsTestMixin, FrappeTestCase): class TestProcessStatementOfAccounts(AccountsTestMixin, IntegrationTestCase):
def setUp(self): def setUp(self):
self.create_company() self.create_company()
self.create_customer() self.create_customer()

View File

@@ -2,8 +2,17 @@
# See license.txt # See license.txt
# import frappe # import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
class TestProcessSubscription(FrappeTestCase): class UnitTestProcessSubscription(UnitTestCase):
"""
Unit tests for ProcessSubscription.
Use this class for testing individual functions and methods.
"""
pass
class TestProcessSubscription(IntegrationTestCase):
pass pass

View File

@@ -3,7 +3,7 @@
import frappe import frappe
from frappe.tests.utils import FrappeTestCase, change_settings from frappe.tests import IntegrationTestCase
from frappe.utils import add_days, cint, flt, getdate, nowdate, today from frappe.utils import add_days, cint, flt, getdate, nowdate, today
import erpnext import erpnext
@@ -42,7 +42,7 @@ test_dependencies = ["Item", "Cost Center", "Payment Term", "Payment Terms Templ
test_ignore = ["Serial No"] test_ignore = ["Serial No"]
class TestPurchaseInvoice(FrappeTestCase, StockTestMixin): class TestPurchaseInvoice(IntegrationTestCase, StockTestMixin):
@classmethod @classmethod
def setUpClass(self): def setUpClass(self):
unlink_payment_on_cancel_of_invoice() unlink_payment_on_cancel_of_invoice()
@@ -461,7 +461,9 @@ class TestPurchaseInvoice(FrappeTestCase, StockTestMixin):
self.assertEqual(tax.tax_amount, expected_values[i][1]) self.assertEqual(tax.tax_amount, expected_values[i][1])
self.assertEqual(tax.total, expected_values[i][2]) self.assertEqual(tax.total, expected_values[i][2])
@change_settings("Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1}) @IntegrationTestCase.change_settings(
"Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1}
)
def test_purchase_invoice_with_advance(self): def test_purchase_invoice_with_advance(self):
from erpnext.accounts.doctype.journal_entry.test_journal_entry import ( from erpnext.accounts.doctype.journal_entry.test_journal_entry import (
test_records as jv_test_records, test_records as jv_test_records,
@@ -516,7 +518,9 @@ class TestPurchaseInvoice(FrappeTestCase, StockTestMixin):
) )
) )
@change_settings("Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1}) @IntegrationTestCase.change_settings(
"Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1}
)
def test_invoice_with_advance_and_multi_payment_terms(self): def test_invoice_with_advance_and_multi_payment_terms(self):
from erpnext.accounts.doctype.journal_entry.test_journal_entry import ( from erpnext.accounts.doctype.journal_entry.test_journal_entry import (
test_records as jv_test_records, test_records as jv_test_records,
@@ -1251,7 +1255,9 @@ class TestPurchaseInvoice(FrappeTestCase, StockTestMixin):
acc_settings.submit_journal_entriessubmit_journal_entries = 0 acc_settings.submit_journal_entriessubmit_journal_entries = 0
acc_settings.save() acc_settings.save()
@change_settings("Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1}) @IntegrationTestCase.change_settings(
"Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1}
)
def test_gain_loss_with_advance_entry(self): def test_gain_loss_with_advance_entry(self):
unlink_enabled = frappe.db.get_single_value( unlink_enabled = frappe.db.get_single_value(
"Accounts Settings", "unlink_payment_on_cancellation_of_invoice" "Accounts Settings", "unlink_payment_on_cancellation_of_invoice"
@@ -1452,7 +1458,9 @@ class TestPurchaseInvoice(FrappeTestCase, StockTestMixin):
) )
frappe.db.set_value("Company", "_Test Company", "exchange_gain_loss_account", original_account) frappe.db.set_value("Company", "_Test Company", "exchange_gain_loss_account", original_account)
@change_settings("Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1}) @IntegrationTestCase.change_settings(
"Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1}
)
def test_purchase_invoice_advance_taxes(self): def test_purchase_invoice_advance_taxes(self):
from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry
@@ -2035,7 +2043,7 @@ class TestPurchaseInvoice(FrappeTestCase, StockTestMixin):
pi.delete() pi.delete()
@change_settings("Buying Settings", {"supplier_group": None}) @IntegrationTestCase.change_settings("Buying Settings", {"supplier_group": None})
def test_purchase_invoice_without_supplier_group(self): def test_purchase_invoice_without_supplier_group(self):
# Create a Supplier # Create a Supplier
test_supplier_name = "_Test Supplier Without Supplier Group" test_supplier_name = "_Test Supplier Without Supplier Group"

View File

@@ -4,7 +4,7 @@
import frappe import frappe
from frappe import qb from frappe import qb
from frappe.query_builder.functions import Sum from frappe.query_builder.functions import Sum
from frappe.tests.utils import FrappeTestCase, change_settings from frappe.tests import IntegrationTestCase
from frappe.utils import add_days, nowdate, today from frappe.utils import add_days, nowdate, today
from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry
@@ -14,7 +14,7 @@ from erpnext.accounts.test.accounts_mixin import AccountsTestMixin
from erpnext.accounts.utils import get_fiscal_year from erpnext.accounts.utils import get_fiscal_year
class TestRepostAccountingLedger(AccountsTestMixin, FrappeTestCase): class TestRepostAccountingLedger(AccountsTestMixin, IntegrationTestCase):
def setUp(self): def setUp(self):
self.create_company() self.create_company()
self.create_customer() self.create_customer()
@@ -114,7 +114,7 @@ class TestRepostAccountingLedger(AccountsTestMixin, FrappeTestCase):
ral.append("vouchers", {"voucher_type": si.doctype, "voucher_no": si.name}) ral.append("vouchers", {"voucher_type": si.doctype, "voucher_no": si.name})
self.assertRaises(frappe.ValidationError, ral.save) self.assertRaises(frappe.ValidationError, ral.save)
@change_settings("Accounts Settings", {"delete_linked_ledger_entries": 1}) @IntegrationTestCase.change_settings("Accounts Settings", {"delete_linked_ledger_entries": 1})
def test_04_pcv_validation(self): def test_04_pcv_validation(self):
# Clear old GL entries so PCV can be submitted. # Clear old GL entries so PCV can be submitted.
gl = frappe.qb.DocType("GL Entry") gl = frappe.qb.DocType("GL Entry")

View File

@@ -2,8 +2,17 @@
# See license.txt # See license.txt
# import frappe # import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
class TestRepostAccountingLedgerSettings(FrappeTestCase): class UnitTestRepostAccountingLedgerSettings(UnitTestCase):
"""
Unit tests for RepostAccountingLedgerSettings.
Use this class for testing individual functions and methods.
"""
pass
class TestRepostAccountingLedgerSettings(IntegrationTestCase):
pass pass

View File

@@ -2,8 +2,17 @@
# See license.txt # See license.txt
# import frappe # import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
class TestRepostPaymentLedger(FrappeTestCase): class UnitTestRepostPaymentLedger(UnitTestCase):
"""
Unit tests for RepostPaymentLedger.
Use this class for testing individual functions and methods.
"""
pass
class TestRepostPaymentLedger(IntegrationTestCase):
pass pass

View File

@@ -7,7 +7,7 @@ import json
import frappe import frappe
from frappe import qb from frappe import qb
from frappe.model.dynamic_links import get_dynamic_link_map from frappe.model.dynamic_links import get_dynamic_link_map
from frappe.tests.utils import FrappeTestCase, change_settings from frappe.tests import IntegrationTestCase, UnitTestCase
from frappe.utils import add_days, flt, format_date, getdate, nowdate, today from frappe.utils import add_days, flt, format_date, getdate, nowdate, today
import erpnext import erpnext
@@ -46,7 +46,16 @@ from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation import
from erpnext.stock.utils import get_incoming_rate, get_stock_balance from erpnext.stock.utils import get_incoming_rate, get_stock_balance
class TestSalesInvoice(FrappeTestCase): class UnitTestSalesInvoice(UnitTestCase):
"""
Unit tests for SalesInvoice.
Use this class for testing individual functions and methods.
"""
pass
class TestSalesInvoice(IntegrationTestCase):
def setUp(self): def setUp(self):
from erpnext.stock.doctype.stock_ledger_entry.test_stock_ledger_entry import create_items from erpnext.stock.doctype.stock_ledger_entry.test_stock_ledger_entry import create_items
@@ -194,7 +203,9 @@ class TestSalesInvoice(FrappeTestCase):
self.assertRaises(frappe.LinkExistsError, si.cancel) self.assertRaises(frappe.LinkExistsError, si.cancel)
unlink_payment_on_cancel_of_invoice() unlink_payment_on_cancel_of_invoice()
@change_settings("Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1}) @IntegrationTestCase.change_settings(
"Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1}
)
def test_payment_entry_unlink_against_standalone_credit_note(self): def test_payment_entry_unlink_against_standalone_credit_note(self):
from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_payment_entry from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_payment_entry
@@ -1383,7 +1394,9 @@ class TestSalesInvoice(FrappeTestCase):
dn.submit() dn.submit()
return dn return dn
@change_settings("Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1}) @IntegrationTestCase.change_settings(
"Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1}
)
def test_sales_invoice_with_advance(self): def test_sales_invoice_with_advance(self):
from erpnext.accounts.doctype.journal_entry.test_journal_entry import ( from erpnext.accounts.doctype.journal_entry.test_journal_entry import (
test_records as jv_test_records, test_records as jv_test_records,
@@ -2885,7 +2898,7 @@ class TestSalesInvoice(FrappeTestCase):
sales_invoice.save() sales_invoice.save()
self.assertEqual(sales_invoice.items[0].item_tax_template, "_Test Account Excise Duty @ 10 - _TC") self.assertEqual(sales_invoice.items[0].item_tax_template, "_Test Account Excise Duty @ 10 - _TC")
@change_settings("Selling Settings", {"enable_discount_accounting": 1}) @IntegrationTestCase.change_settings("Selling Settings", {"enable_discount_accounting": 1})
def test_sales_invoice_with_discount_accounting_enabled(self): def test_sales_invoice_with_discount_accounting_enabled(self):
discount_account = create_account( discount_account = create_account(
account_name="Discount Account", account_name="Discount Account",
@@ -2902,7 +2915,7 @@ class TestSalesInvoice(FrappeTestCase):
check_gl_entries(self, si.name, expected_gle, add_days(nowdate(), -1)) check_gl_entries(self, si.name, expected_gle, add_days(nowdate(), -1))
@change_settings("Selling Settings", {"enable_discount_accounting": 1}) @IntegrationTestCase.change_settings("Selling Settings", {"enable_discount_accounting": 1})
def test_additional_discount_for_sales_invoice_with_discount_accounting_enabled(self): def test_additional_discount_for_sales_invoice_with_discount_accounting_enabled(self):
from erpnext.accounts.doctype.repost_accounting_ledger.test_repost_accounting_ledger import ( from erpnext.accounts.doctype.repost_accounting_ledger.test_repost_accounting_ledger import (
update_repost_settings, update_repost_settings,
@@ -3336,7 +3349,7 @@ class TestSalesInvoice(FrappeTestCase):
si.commission_rate = commission_rate si.commission_rate = commission_rate
self.assertRaises(frappe.ValidationError, si.save) self.assertRaises(frappe.ValidationError, si.save)
@change_settings("Accounts Settings", {"acc_frozen_upto": add_days(getdate(), 1)}) @IntegrationTestCase.change_settings("Accounts Settings", {"acc_frozen_upto": add_days(getdate(), 1)})
def test_sales_invoice_submission_post_account_freezing_date(self): def test_sales_invoice_submission_post_account_freezing_date(self):
si = create_sales_invoice(do_not_save=True) si = create_sales_invoice(do_not_save=True)
si.posting_date = add_days(getdate(), 1) si.posting_date = add_days(getdate(), 1)
@@ -3372,7 +3385,7 @@ class TestSalesInvoice(FrappeTestCase):
frappe.db.set_single_value("Accounts Settings", "over_billing_allowance", over_billing_allowance) frappe.db.set_single_value("Accounts Settings", "over_billing_allowance", over_billing_allowance)
@change_settings( @IntegrationTestCase.change_settings(
"Accounts Settings", "Accounts Settings",
{ {
"book_deferred_entries_via_journal_entry": 1, "book_deferred_entries_via_journal_entry": 1,
@@ -3492,7 +3505,9 @@ class TestSalesInvoice(FrappeTestCase):
account.disabled = 0 account.disabled = 0
account.save() account.save()
@change_settings("Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1}) @IntegrationTestCase.change_settings(
"Accounts Settings", {"unlink_payment_on_cancellation_of_invoice": 1}
)
def test_gain_loss_with_advance_entry(self): def test_gain_loss_with_advance_entry(self):
from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry
@@ -3655,7 +3670,7 @@ class TestSalesInvoice(FrappeTestCase):
set_advance_flag(company="_Test Company", flag=0, default_account="") set_advance_flag(company="_Test Company", flag=0, default_account="")
@change_settings("Selling Settings", {"customer_group": None, "territory": None}) @IntegrationTestCase.change_settings("Selling Settings", {"customer_group": None, "territory": None})
def test_sales_invoice_without_customer_group_and_territory(self): def test_sales_invoice_without_customer_group_and_territory(self):
# create a customer # create a customer
if not frappe.db.exists("Customer", "_Test Simple Customer"): if not frappe.db.exists("Customer", "_Test Simple Customer"):
@@ -3673,7 +3688,7 @@ class TestSalesInvoice(FrappeTestCase):
self.assertEqual(si.customer_group, None) self.assertEqual(si.customer_group, None)
self.assertEqual(si.territory, None) self.assertEqual(si.territory, None)
@change_settings("Selling Settings", {"allow_negative_rates_for_items": 0}) @IntegrationTestCase.change_settings("Selling Settings", {"allow_negative_rates_for_items": 0})
def test_sales_return_negative_rate(self): def test_sales_return_negative_rate(self):
si = create_sales_invoice(is_return=1, qty=-2, rate=-10, do_not_save=True) si = create_sales_invoice(is_return=1, qty=-2, rate=-10, do_not_save=True)
self.assertRaises(frappe.ValidationError, si.save) self.assertRaises(frappe.ValidationError, si.save)
@@ -4089,7 +4104,7 @@ class TestSalesInvoice(FrappeTestCase):
self.assertEqual(len(actual), 4) self.assertEqual(len(actual), 4)
self.assertEqual(expected, actual) self.assertEqual(expected, actual)
@change_settings("Accounts Settings", {"enable_common_party_accounting": True}) @IntegrationTestCase.change_settings("Accounts Settings", {"enable_common_party_accounting": True})
def test_common_party_with_foreign_currency_jv(self): def test_common_party_with_foreign_currency_jv(self):
from erpnext.accounts.doctype.account.test_account import create_account from erpnext.accounts.doctype.account.test_account import create_account
from erpnext.accounts.doctype.opening_invoice_creation_tool.test_opening_invoice_creation_tool import ( from erpnext.accounts.doctype.opening_invoice_creation_tool.test_opening_invoice_creation_tool import (

View File

@@ -3,7 +3,7 @@
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
from frappe.utils.data import ( from frappe.utils.data import (
add_days, add_days,
add_months, add_months,
@@ -21,7 +21,16 @@ from erpnext.accounts.doctype.subscription.subscription import get_prorata_facto
test_dependencies = ("UOM", "Item Group", "Item") test_dependencies = ("UOM", "Item Group", "Item")
class TestSubscription(FrappeTestCase): class UnitTestSubscription(UnitTestCase):
"""
Unit tests for Subscription.
Use this class for testing individual functions and methods.
"""
pass
class TestSubscription(IntegrationTestCase):
def setUp(self): def setUp(self):
make_plans() make_plans()
create_parties() create_parties()

View File

@@ -6,7 +6,7 @@ import unittest
import frappe import frappe
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
from frappe.tests.utils import FrappeTestCase, change_settings from frappe.tests import IntegrationTestCase, UnitTestCase
from frappe.utils import add_days, today from frappe.utils import add_days, today
from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry
@@ -16,7 +16,16 @@ from erpnext.buying.doctype.purchase_order.purchase_order import make_purchase_i
test_dependencies = ["Supplier Group", "Customer Group"] test_dependencies = ["Supplier Group", "Customer Group"]
class TestTaxWithholdingCategory(FrappeTestCase): class UnitTestTaxWithholdingCategory(UnitTestCase):
"""
Unit tests for TaxWithholdingCategory.
Use this class for testing individual functions and methods.
"""
pass
class TestTaxWithholdingCategory(IntegrationTestCase):
@classmethod @classmethod
def setUpClass(self): def setUpClass(self):
# create relevant supplier, etc # create relevant supplier, etc

View File

@@ -2,7 +2,7 @@
# See license.txt # See license.txt
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase
from frappe.utils import today from frappe.utils import today
from erpnext.accounts.doctype.payment_entry.test_payment_entry import create_payment_entry from erpnext.accounts.doctype.payment_entry.test_payment_entry import create_payment_entry
@@ -11,7 +11,7 @@ from erpnext.accounts.test.accounts_mixin import AccountsTestMixin
from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
class TestUnreconcilePayment(AccountsTestMixin, FrappeTestCase): class TestUnreconcilePayment(AccountsTestMixin, IntegrationTestCase):
def setUp(self): def setUp(self):
self.create_company() self.create_company()
self.create_customer() self.create_customer()

View File

@@ -1,5 +1,5 @@
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase
from frappe.utils import today from frappe.utils import today
from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice
@@ -7,7 +7,7 @@ from erpnext.accounts.report.accounts_payable.accounts_payable import execute
from erpnext.accounts.test.accounts_mixin import AccountsTestMixin from erpnext.accounts.test.accounts_mixin import AccountsTestMixin
class TestAccountsPayable(AccountsTestMixin, FrappeTestCase): class TestAccountsPayable(AccountsTestMixin, IntegrationTestCase):
def setUp(self): def setUp(self):
self.create_company() self.create_company()
self.create_customer() self.create_customer()

View File

@@ -1,6 +1,6 @@
import frappe import frappe
from frappe import qb from frappe import qb
from frappe.tests.utils import FrappeTestCase, change_settings from frappe.tests import IntegrationTestCase
from frappe.utils import add_days, flt, getdate, today from frappe.utils import add_days, flt, getdate, today
from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry
@@ -10,7 +10,7 @@ from erpnext.accounts.test.accounts_mixin import AccountsTestMixin
from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
class TestAccountsReceivable(AccountsTestMixin, FrappeTestCase): class TestAccountsReceivable(AccountsTestMixin, IntegrationTestCase):
def setUp(self): def setUp(self):
self.create_company() self.create_company()
self.create_customer() self.create_customer()
@@ -275,7 +275,7 @@ class TestAccountsReceivable(AccountsTestMixin, FrappeTestCase):
], ],
) )
@change_settings( @IntegrationTestCase.change_settings(
"Accounts Settings", "Accounts Settings",
{"allow_multi_currency_invoices_against_single_party_account": 1, "allow_stale": 0}, {"allow_multi_currency_invoices_against_single_party_account": 1, "allow_stale": 0},
) )

View File

@@ -1,5 +1,5 @@
import frappe import frappe
from frappe.tests.utils import FrappeTestCase, change_settings from frappe.tests import IntegrationTestCase
from frappe.utils import today from frappe.utils import today
from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry
@@ -8,7 +8,7 @@ from erpnext.accounts.report.accounts_receivable_summary.accounts_receivable_sum
from erpnext.accounts.test.accounts_mixin import AccountsTestMixin from erpnext.accounts.test.accounts_mixin import AccountsTestMixin
class TestAccountsReceivable(AccountsTestMixin, FrappeTestCase): class TestAccountsReceivable(AccountsTestMixin, IntegrationTestCase):
def setUp(self): def setUp(self):
self.maxDiff = None self.maxDiff = None
self.create_company() self.create_company()
@@ -112,7 +112,7 @@ class TestAccountsReceivable(AccountsTestMixin, FrappeTestCase):
self.assertEqual(len(rpt_output), 1) self.assertEqual(len(rpt_output), 1)
self.assertDictEqual(rpt_output[0], expected_data) self.assertDictEqual(rpt_output[0], expected_data)
@change_settings("Selling Settings", {"cust_master_name": "Naming Series"}) @IntegrationTestCase.change_settings("Selling Settings", {"cust_master_name": "Naming Series"})
def test_02_various_filters_and_output(self): def test_02_various_filters_and_output(self):
filters = { filters = {
"company": self.company, "company": self.company,

View File

@@ -2,7 +2,7 @@
# MIT License. See license.txt # MIT License. See license.txt
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase
from frappe.utils.data import today from frappe.utils.data import today
from erpnext.accounts.report.balance_sheet.balance_sheet import execute from erpnext.accounts.report.balance_sheet.balance_sheet import execute
@@ -13,7 +13,7 @@ COMPANY_SHORT_NAME = "_TC6"
test_dependencies = ["Company"] test_dependencies = ["Company"]
class TestBalanceSheet(FrappeTestCase): class TestBalanceSheet(IntegrationTestCase):
def test_balance_sheet(self): def test_balance_sheet(self):
frappe.db.sql(f"delete from `tabJournal Entry` where company='{COMPANY}'") frappe.db.sql(f"delete from `tabJournal Entry` where company='{COMPANY}'")
frappe.db.sql(f"delete from `tabGL Entry` where company='{COMPANY}'") frappe.db.sql(f"delete from `tabGL Entry` where company='{COMPANY}'")

View File

@@ -2,7 +2,7 @@
# See license.txt # See license.txt
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase
from erpnext.accounts.report.bank_reconciliation_statement.bank_reconciliation_statement import ( from erpnext.accounts.report.bank_reconciliation_statement.bank_reconciliation_statement import (
execute, execute,
@@ -10,7 +10,7 @@ from erpnext.accounts.report.bank_reconciliation_statement.bank_reconciliation_s
from erpnext.tests.utils import if_lending_app_installed from erpnext.tests.utils import if_lending_app_installed
class TestBankReconciliationStatement(FrappeTestCase): class TestBankReconciliationStatement(IntegrationTestCase):
def setUp(self): def setUp(self):
for dt in [ for dt in [
"Journal Entry", "Journal Entry",

View File

@@ -1,6 +1,6 @@
import frappe import frappe
from frappe import qb from frappe import qb
from frappe.tests.utils import FrappeTestCase, change_settings from frappe.tests import IntegrationTestCase
from frappe.utils import nowdate from frappe.utils import nowdate
from erpnext.accounts.doctype.account.test_account import create_account from erpnext.accounts.doctype.account.test_account import create_account
@@ -13,7 +13,7 @@ from erpnext.accounts.test.accounts_mixin import AccountsTestMixin
from erpnext.accounts.utils import get_fiscal_year from erpnext.accounts.utils import get_fiscal_year
class TestDeferredRevenueAndExpense(FrappeTestCase, AccountsTestMixin): class TestDeferredRevenueAndExpense(IntegrationTestCase, AccountsTestMixin):
@classmethod @classmethod
def setUpClass(self): def setUpClass(self):
self.maxDiff = None self.maxDiff = None
@@ -72,7 +72,7 @@ class TestDeferredRevenueAndExpense(FrappeTestCase, AccountsTestMixin):
def tearDown(self): def tearDown(self):
frappe.db.rollback() frappe.db.rollback()
@change_settings("Accounts Settings", {"book_deferred_entries_based_on": "Months"}) @IntegrationTestCase.change_settings("Accounts Settings", {"book_deferred_entries_based_on": "Months"})
def test_deferred_revenue(self): def test_deferred_revenue(self):
self.create_item("_Test Internet Subscription", 0, self.warehouse, self.company) self.create_item("_Test Internet Subscription", 0, self.warehouse, self.company)
item = frappe.get_doc("Item", self.item) item = frappe.get_doc("Item", self.item)
@@ -141,7 +141,7 @@ class TestDeferredRevenueAndExpense(FrappeTestCase, AccountsTestMixin):
] ]
self.assertEqual(report.period_total, expected) self.assertEqual(report.period_total, expected)
@change_settings("Accounts Settings", {"book_deferred_entries_based_on": "Months"}) @IntegrationTestCase.change_settings("Accounts Settings", {"book_deferred_entries_based_on": "Months"})
def test_deferred_expense(self): def test_deferred_expense(self):
self.create_item("_Test Office Desk", 0, self.warehouse, self.company) self.create_item("_Test Office Desk", 0, self.warehouse, self.company)
item = frappe.get_doc("Item", self.item) item = frappe.get_doc("Item", self.item)
@@ -213,7 +213,7 @@ class TestDeferredRevenueAndExpense(FrappeTestCase, AccountsTestMixin):
] ]
self.assertEqual(report.period_total, expected) self.assertEqual(report.period_total, expected)
@change_settings("Accounts Settings", {"book_deferred_entries_based_on": "Months"}) @IntegrationTestCase.change_settings("Accounts Settings", {"book_deferred_entries_based_on": "Months"})
def test_zero_months(self): def test_zero_months(self):
self.create_item("_Test Internet Subscription", 0, self.warehouse, self.company) self.create_item("_Test Internet Subscription", 0, self.warehouse, self.company)
item = frappe.get_doc("Item", self.item) item = frappe.get_doc("Item", self.item)
@@ -280,7 +280,7 @@ class TestDeferredRevenueAndExpense(FrappeTestCase, AccountsTestMixin):
] ]
self.assertEqual(report.period_total, expected) self.assertEqual(report.period_total, expected)
@change_settings( @IntegrationTestCase.change_settings(
"Accounts Settings", "Accounts Settings",
{"book_deferred_entries_based_on": "Months", "book_deferred_entries_via_journal_entry": 0}, {"book_deferred_entries_based_on": "Months", "book_deferred_entries_via_journal_entry": 0},
) )

View File

@@ -1,6 +1,6 @@
import frappe import frappe
from frappe import qb from frappe import qb
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase
from frappe.utils import add_days from frappe.utils import add_days
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
@@ -10,7 +10,7 @@ from erpnext.accounts.report.general_and_payment_ledger_comparison.general_and_p
from erpnext.accounts.test.accounts_mixin import AccountsTestMixin from erpnext.accounts.test.accounts_mixin import AccountsTestMixin
class TestGeneralAndPaymentLedger(FrappeTestCase, AccountsTestMixin): class TestGeneralAndPaymentLedger(IntegrationTestCase, AccountsTestMixin):
def setUp(self): def setUp(self):
self.create_company() self.create_company()
self.cleanup() self.cleanup()

View File

@@ -3,7 +3,7 @@
import frappe import frappe
from frappe import qb from frappe import qb
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase
from frappe.utils import flt, today from frappe.utils import flt, today
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
@@ -11,7 +11,7 @@ from erpnext.accounts.report.general_ledger.general_ledger import execute
from erpnext.controllers.sales_and_purchase_return import make_return_doc from erpnext.controllers.sales_and_purchase_return import make_return_doc
class TestGeneralLedger(FrappeTestCase): class TestGeneralLedger(IntegrationTestCase):
def setUp(self): def setUp(self):
self.company = "_Test Company" self.company = "_Test Company"
self.clear_old_entries() self.clear_old_entries()

View File

@@ -1,6 +1,6 @@
import frappe import frappe
from frappe import qb from frappe import qb
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase
from frappe.utils import flt, nowdate from frappe.utils import flt, nowdate
from erpnext.accounts.doctype.sales_invoice.sales_invoice import make_delivery_note from erpnext.accounts.doctype.sales_invoice.sales_invoice import make_delivery_note
@@ -12,7 +12,7 @@ from erpnext.stock.doctype.item.test_item import create_item
from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
class TestGrossProfit(FrappeTestCase): class TestGrossProfit(IntegrationTestCase):
def setUp(self): def setUp(self):
self.create_company() self.create_company()
self.create_item() self.create_item()

View File

@@ -1,5 +1,5 @@
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase
from frappe.utils import getdate, today from frappe.utils import getdate, today
from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice
@@ -7,7 +7,7 @@ from erpnext.accounts.report.item_wise_purchase_register.item_wise_purchase_regi
from erpnext.accounts.test.accounts_mixin import AccountsTestMixin from erpnext.accounts.test.accounts_mixin import AccountsTestMixin
class TestItemWisePurchaseRegister(AccountsTestMixin, FrappeTestCase): class TestItemWisePurchaseRegister(AccountsTestMixin, IntegrationTestCase):
def setUp(self): def setUp(self):
self.create_company() self.create_company()
self.create_supplier() self.create_supplier()

View File

@@ -1,5 +1,5 @@
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase
from frappe.utils import getdate, today from frappe.utils import getdate, today
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
@@ -7,7 +7,7 @@ from erpnext.accounts.report.item_wise_sales_register.item_wise_sales_register i
from erpnext.accounts.test.accounts_mixin import AccountsTestMixin from erpnext.accounts.test.accounts_mixin import AccountsTestMixin
class TestItemWiseSalesRegister(AccountsTestMixin, FrappeTestCase): class TestItemWiseSalesRegister(AccountsTestMixin, IntegrationTestCase):
def setUp(self): def setUp(self):
self.create_company() self.create_company()
self.create_customer() self.create_customer()

View File

@@ -1,13 +1,13 @@
import frappe import frappe
from frappe import qb from frappe import qb
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase
from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry
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
from erpnext.accounts.report.payment_ledger.payment_ledger import execute from erpnext.accounts.report.payment_ledger.payment_ledger import execute
class TestPaymentLedger(FrappeTestCase): class TestPaymentLedger(IntegrationTestCase):
def setUp(self): def setUp(self):
self.create_company() self.create_company()
self.cleanup() self.cleanup()

View File

@@ -2,7 +2,7 @@
# MIT License. See license.txt # MIT License. See license.txt
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase
from frappe.utils import getdate, today from frappe.utils import getdate, today
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
@@ -11,7 +11,7 @@ from erpnext.accounts.report.profit_and_loss_statement.profit_and_loss_statement
from erpnext.accounts.test.accounts_mixin import AccountsTestMixin from erpnext.accounts.test.accounts_mixin import AccountsTestMixin
class TestProfitAndLossStatement(AccountsTestMixin, FrappeTestCase): class TestProfitAndLossStatement(AccountsTestMixin, IntegrationTestCase):
def setUp(self): def setUp(self):
self.create_company() self.create_company()
self.create_customer() self.create_customer()

View File

@@ -2,13 +2,13 @@
# MIT License. See license.txt # MIT License. See license.txt
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase
from frappe.utils import add_months, today from frappe.utils import add_months, today
from erpnext.accounts.report.purchase_register.purchase_register import execute from erpnext.accounts.report.purchase_register.purchase_register import execute
class TestPurchaseRegister(FrappeTestCase): class TestPurchaseRegister(IntegrationTestCase):
def test_purchase_register(self): def test_purchase_register(self):
frappe.db.sql("delete from `tabPurchase Invoice` where company='_Test Company 6'") frappe.db.sql("delete from `tabPurchase Invoice` where company='_Test Company 6'")
frappe.db.sql("delete from `tabGL Entry` where company='_Test Company 6'") frappe.db.sql("delete from `tabGL Entry` where company='_Test Company 6'")

View File

@@ -2,7 +2,7 @@
# MIT License. See license.txt # MIT License. See license.txt
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase
from frappe.utils import today from frappe.utils import today
from erpnext.accounts.doctype.payment_entry.test_payment_entry import create_payment_entry from erpnext.accounts.doctype.payment_entry.test_payment_entry import create_payment_entry
@@ -16,7 +16,7 @@ from erpnext.accounts.test.accounts_mixin import AccountsTestMixin
from erpnext.accounts.utils import get_fiscal_year from erpnext.accounts.utils import get_fiscal_year
class TestTaxWithholdingDetails(AccountsTestMixin, FrappeTestCase): class TestTaxWithholdingDetails(AccountsTestMixin, IntegrationTestCase):
def setUp(self): def setUp(self):
self.create_company() self.create_company()
self.clear_old_entries() self.clear_old_entries()

View File

@@ -2,13 +2,13 @@
# MIT License. See license.txt # MIT License. See license.txt
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase
from frappe.utils import today from frappe.utils import today
from erpnext.accounts.report.trial_balance.trial_balance import execute from erpnext.accounts.report.trial_balance.trial_balance import execute
class TestTrialBalance(FrappeTestCase): class TestTrialBalance(IntegrationTestCase):
def setUp(self): def setUp(self):
from erpnext.accounts.doctype.account.test_account import create_account from erpnext.accounts.doctype.account.test_account import create_account
from erpnext.accounts.doctype.cost_center.test_cost_center import create_cost_center from erpnext.accounts.doctype.cost_center.test_cost_center import create_cost_center

View File

@@ -1,10 +1,10 @@
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase
from erpnext.accounts.party import get_default_price_list from erpnext.accounts.party import get_default_price_list
class PartyTestCase(FrappeTestCase): class PartyTestCase(IntegrationTestCase):
def test_get_default_price_list_should_return_none_for_invalid_group(self): def test_get_default_price_list_should_return_none_for_invalid_group(self):
customer = frappe.get_doc( customer = frappe.get_doc(
{ {

View File

@@ -2,8 +2,17 @@
# See license.txt # See license.txt
# import frappe # import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
class TestAssetActivity(FrappeTestCase): class UnitTestAssetActivity(UnitTestCase):
"""
Unit tests for AssetActivity.
Use this class for testing individual functions and methods.
"""
pass
class TestAssetActivity(IntegrationTestCase):
pass pass

View File

@@ -2,7 +2,7 @@
# See license.txt # See license.txt
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
from frappe.utils import cstr, flt from frappe.utils import cstr, flt
from erpnext.assets.doctype.asset.depreciation import ( from erpnext.assets.doctype.asset.depreciation import (
@@ -15,7 +15,16 @@ from erpnext.assets.doctype.asset_depreciation_schedule.asset_depreciation_sched
) )
class TestAssetDepreciationSchedule(FrappeTestCase): class UnitTestAssetDepreciationSchedule(UnitTestCase):
"""
Unit tests for AssetDepreciationSchedule.
Use this class for testing individual functions and methods.
"""
pass
class TestAssetDepreciationSchedule(IntegrationTestCase):
def setUp(self): def setUp(self):
create_asset_data() create_asset_data()

View File

@@ -2,7 +2,7 @@
# See license.txt # See license.txt
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
from frappe.utils import cstr from frappe.utils import cstr
from erpnext.assets.doctype.asset.test_asset import create_asset from erpnext.assets.doctype.asset.test_asset import create_asset
@@ -11,7 +11,16 @@ from erpnext.assets.doctype.asset_depreciation_schedule.asset_depreciation_sched
) )
class TestAssetShiftAllocation(FrappeTestCase): class UnitTestAssetShiftAllocation(UnitTestCase):
"""
Unit tests for AssetShiftAllocation.
Use this class for testing individual functions and methods.
"""
pass
class TestAssetShiftAllocation(IntegrationTestCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
create_asset_shift_factors() create_asset_shift_factors()

View File

@@ -2,8 +2,17 @@
# See license.txt # See license.txt
# import frappe # import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
class TestAssetShiftFactor(FrappeTestCase): class UnitTestAssetShiftFactor(UnitTestCase):
"""
Unit tests for AssetShiftFactor.
Use this class for testing individual functions and methods.
"""
pass
class TestAssetShiftFactor(IntegrationTestCase):
pass pass

View File

@@ -2,8 +2,17 @@
# See license.txt # See license.txt
# import frappe # import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
class TestBulkTransactionLog(FrappeTestCase): class UnitTestBulkTransactionLog(UnitTestCase):
"""
Unit tests for BulkTransactionLog.
Use this class for testing individual functions and methods.
"""
pass
class TestBulkTransactionLog(IntegrationTestCase):
pass pass

View File

@@ -2,8 +2,17 @@
# See license.txt # See license.txt
# import frappe # import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
class TestBulkTransactionLogDetail(FrappeTestCase): class UnitTestBulkTransactionLogDetail(UnitTestCase):
"""
Unit tests for BulkTransactionLogDetail.
Use this class for testing individual functions and methods.
"""
pass
class TestBulkTransactionLogDetail(IntegrationTestCase):
pass pass

View File

@@ -5,7 +5,7 @@
import json import json
import frappe import frappe
from frappe.tests.utils import FrappeTestCase, change_settings from frappe.tests import IntegrationTestCase, UnitTestCase
from frappe.utils import add_days, flt, getdate, nowdate from frappe.utils import add_days, flt, getdate, nowdate
from frappe.utils.data import today from frappe.utils.data import today
@@ -28,7 +28,16 @@ from erpnext.stock.doctype.purchase_receipt.purchase_receipt import (
) )
class TestPurchaseOrder(FrappeTestCase): class UnitTestPurchaseOrder(UnitTestCase):
"""
Unit tests for PurchaseOrder.
Use this class for testing individual functions and methods.
"""
pass
class TestPurchaseOrder(IntegrationTestCase):
def test_purchase_order_qty(self): def test_purchase_order_qty(self):
po = create_purchase_order(qty=1, do_not_save=True) po = create_purchase_order(qty=1, do_not_save=True)
@@ -735,7 +744,9 @@ class TestPurchaseOrder(FrappeTestCase):
pi.insert() pi.insert()
self.assertTrue(pi.get("payment_schedule")) self.assertTrue(pi.get("payment_schedule"))
@change_settings("Accounts Settings", {"unlink_advance_payment_on_cancelation_of_order": 1}) @IntegrationTestCase.change_settings(
"Accounts Settings", {"unlink_advance_payment_on_cancelation_of_order": 1}
)
def test_advance_payment_entry_unlink_against_purchase_order(self): def test_advance_payment_entry_unlink_against_purchase_order(self):
from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_payment_entry from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_payment_entry
@@ -806,7 +817,9 @@ class TestPurchaseOrder(FrappeTestCase):
company_doc.book_advance_payments_in_separate_party_account = False company_doc.book_advance_payments_in_separate_party_account = False
company_doc.save() company_doc.save()
@change_settings("Accounts Settings", {"unlink_advance_payment_on_cancelation_of_order": 1}) @IntegrationTestCase.change_settings(
"Accounts Settings", {"unlink_advance_payment_on_cancelation_of_order": 1}
)
def test_advance_paid_upon_payment_entry_cancellation(self): def test_advance_paid_upon_payment_entry_cancellation(self):
from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_payment_entry from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_payment_entry
@@ -1067,7 +1080,7 @@ class TestPurchaseOrder(FrappeTestCase):
self.assertEqual(po.items[0].qty, 30) self.assertEqual(po.items[0].qty, 30)
self.assertEqual(po.items[0].fg_item_qty, 30) self.assertEqual(po.items[0].fg_item_qty, 30)
@change_settings("Buying Settings", {"auto_create_subcontracting_order": 1}) @IntegrationTestCase.change_settings("Buying Settings", {"auto_create_subcontracting_order": 1})
def test_auto_create_subcontracting_order(self): def test_auto_create_subcontracting_order(self):
from erpnext.controllers.tests.test_subcontracting_controller import ( from erpnext.controllers.tests.test_subcontracting_controller import (
make_bom_for_subcontracted_items, make_bom_for_subcontracted_items,

View File

@@ -5,7 +5,7 @@
from urllib.parse import urlparse from urllib.parse import urlparse
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
from frappe.utils import nowdate from frappe.utils import nowdate
from erpnext.buying.doctype.request_for_quotation.request_for_quotation import ( from erpnext.buying.doctype.request_for_quotation.request_for_quotation import (
@@ -21,7 +21,16 @@ from erpnext.stock.doctype.item.test_item import make_item
from erpnext.templates.pages.rfq import check_supplier_has_docname_access from erpnext.templates.pages.rfq import check_supplier_has_docname_access
class TestRequestforQuotation(FrappeTestCase): class UnitTestRequestForQuotation(UnitTestCase):
"""
Unit tests for RequestForQuotation.
Use this class for testing individual functions and methods.
"""
pass
class TestRequestforQuotation(IntegrationTestCase):
def test_rfq_qty(self): def test_rfq_qty(self):
rfq = make_request_for_quotation(qty=0, do_not_save=True) rfq = make_request_for_quotation(qty=0, do_not_save=True)
with self.assertRaises(InvalidQtyError): with self.assertRaises(InvalidQtyError):

View File

@@ -3,7 +3,7 @@
import frappe import frappe
from frappe.test_runner import make_test_records from frappe.tests.utils import make_test_records
from erpnext.accounts.party import get_due_date from erpnext.accounts.party import get_due_date
from erpnext.controllers.website_list_for_contact import get_customers_suppliers from erpnext.controllers.website_list_for_contact import get_customers_suppliers
@@ -12,10 +12,19 @@ from erpnext.exceptions import PartyDisabled
test_dependencies = ["Payment Term", "Payment Terms Template"] test_dependencies = ["Payment Term", "Payment Terms Template"]
test_records = frappe.get_test_records("Supplier") test_records = frappe.get_test_records("Supplier")
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
class TestSupplier(FrappeTestCase): class UnitTestSupplier(UnitTestCase):
"""
Unit tests for Supplier.
Use this class for testing individual functions and methods.
"""
pass
class TestSupplier(IntegrationTestCase):
def test_get_supplier_group_details(self): def test_get_supplier_group_details(self):
doc = frappe.new_doc("Supplier Group") doc = frappe.new_doc("Supplier Group")
doc.supplier_group_name = "_Testing Supplier Group" doc.supplier_group_name = "_Testing Supplier Group"
@@ -180,7 +189,7 @@ def create_supplier(**args):
return doc return doc
class TestSupplierPortal(FrappeTestCase): class TestSupplierPortal(IntegrationTestCase):
def test_portal_user_can_access_supplier_data(self): def test_portal_user_can_access_supplier_data(self):
supplier = create_supplier() supplier = create_supplier()

View File

@@ -3,12 +3,21 @@
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
from erpnext.controllers.accounts_controller import InvalidQtyError from erpnext.controllers.accounts_controller import InvalidQtyError
class TestPurchaseOrder(FrappeTestCase): class UnitTestSupplierQuotation(UnitTestCase):
"""
Unit tests for SupplierQuotation.
Use this class for testing individual functions and methods.
"""
pass
class TestPurchaseOrder(IntegrationTestCase):
def test_supplier_quotation_qty(self): def test_supplier_quotation_qty(self):
sq = frappe.copy_doc(test_records[0]) sq = frappe.copy_doc(test_records[0])
sq.items[0].qty = 0 sq.items[0].qty = 0

View File

@@ -3,10 +3,19 @@
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
class TestSupplierScorecard(FrappeTestCase): class UnitTestSupplierScorecard(UnitTestCase):
"""
Unit tests for SupplierScorecard.
Use this class for testing individual functions and methods.
"""
pass
class TestSupplierScorecard(IntegrationTestCase):
def test_create_scorecard(self): def test_create_scorecard(self):
doc = make_supplier_scorecard().insert() doc = make_supplier_scorecard().insert()
self.assertEqual(doc.name, valid_scorecard[0].get("supplier")) self.assertEqual(doc.name, valid_scorecard[0].get("supplier"))

View File

@@ -3,10 +3,19 @@
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
class TestSupplierScorecardCriteria(FrappeTestCase): class UnitTestSupplierScorecardCriteria(UnitTestCase):
"""
Unit tests for SupplierScorecardCriteria.
Use this class for testing individual functions and methods.
"""
pass
class TestSupplierScorecardCriteria(IntegrationTestCase):
def test_variables_exist(self): def test_variables_exist(self):
delete_test_scorecards() delete_test_scorecards()
for d in test_good_criteria: for d in test_good_criteria:

View File

@@ -3,14 +3,23 @@
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
from erpnext.buying.doctype.supplier_scorecard_variable.supplier_scorecard_variable import ( from erpnext.buying.doctype.supplier_scorecard_variable.supplier_scorecard_variable import (
VariablePathNotFound, VariablePathNotFound,
) )
class TestSupplierScorecardVariable(FrappeTestCase): class UnitTestSupplierScorecardVariable(UnitTestCase):
"""
Unit tests for SupplierScorecardVariable.
Use this class for testing individual functions and methods.
"""
pass
class TestSupplierScorecardVariable(IntegrationTestCase):
def test_variable_exist(self): def test_variable_exist(self):
for d in test_existing_variables: for d in test_existing_variables:
my_doc = frappe.get_doc("Supplier Scorecard Variable", d.get("name")) my_doc = frappe.get_doc("Supplier Scorecard Variable", d.get("name"))

View File

@@ -2,8 +2,8 @@
# For license information, please see license.txt # For license information, please see license.txt
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase
class TestProcurementTracker(FrappeTestCase): class TestProcurementTracker(IntegrationTestCase):
pass pass

View File

@@ -2,7 +2,7 @@
# See license.txt # See license.txt
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase
from frappe.utils import add_days, today from frappe.utils import add_days, today
from erpnext.buying.doctype.purchase_order.purchase_order import make_purchase_receipt from erpnext.buying.doctype.purchase_order.purchase_order import make_purchase_receipt
@@ -13,7 +13,7 @@ from erpnext.stock.doctype.item.test_item import create_item
from erpnext.stock.doctype.material_request.material_request import make_purchase_order from erpnext.stock.doctype.material_request.material_request import make_purchase_order
class TestRequestedItemsToOrderAndReceive(FrappeTestCase): class TestRequestedItemsToOrderAndReceive(IntegrationTestCase):
def setUp(self) -> None: def setUp(self) -> None:
create_item("Test MR Report Item") create_item("Test MR Report Item")
self.setup_material_request() # to order and receive self.setup_material_request() # to order and receive

View File

@@ -7,7 +7,7 @@
import copy import copy
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase
from erpnext.buying.report.subcontracted_item_to_be_received.subcontracted_item_to_be_received import ( from erpnext.buying.report.subcontracted_item_to_be_received.subcontracted_item_to_be_received import (
execute, execute,
@@ -24,7 +24,7 @@ from erpnext.subcontracting.doctype.subcontracting_order.subcontracting_order im
) )
class TestSubcontractedItemToBeReceived(FrappeTestCase): class TestSubcontractedItemToBeReceived(IntegrationTestCase):
def test_pending_and_received_qty(self): def test_pending_and_received_qty(self):
make_service_item("Subcontracted Service Item 1") make_service_item("Subcontracted Service Item 1")
service_items = [ service_items = [

View File

@@ -4,7 +4,7 @@
# Decompiled by https://python-decompiler.com # Decompiled by https://python-decompiler.com
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase
from erpnext.buying.report.subcontracted_raw_materials_to_be_transferred.subcontracted_raw_materials_to_be_transferred import ( from erpnext.buying.report.subcontracted_raw_materials_to_be_transferred.subcontracted_raw_materials_to_be_transferred import (
execute, execute,
@@ -17,7 +17,7 @@ from erpnext.controllers.tests.test_subcontracting_controller import (
from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry
class TestSubcontractedItemToBeTransferred(FrappeTestCase): class TestSubcontractedItemToBeTransferred(IntegrationTestCase):
def test_pending_and_transferred_qty(self): def test_pending_and_transferred_qty(self):
make_service_item("Subcontracted Service Item 1") make_service_item("Subcontracted Service Item 1")
service_items = [ service_items = [

View File

@@ -5,7 +5,7 @@
import frappe import frappe
from frappe import qb from frappe import qb
from frappe.query_builder.functions import Sum from frappe.query_builder.functions import Sum
from frappe.tests.utils import FrappeTestCase, change_settings from frappe.tests import IntegrationTestCase
from frappe.utils import add_days, getdate, nowdate from frappe.utils import add_days, getdate, nowdate
from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry
@@ -46,7 +46,7 @@ def make_supplier(supplier_name, currency=None):
return supplier_name return supplier_name
class TestAccountsController(FrappeTestCase): class TestAccountsController(IntegrationTestCase):
""" """
Test Exchange Gain/Loss booking on various scenarios. Test Exchange Gain/Loss booking on various scenarios.
Test Cases are numbered for better organization Test Cases are numbered for better organization
@@ -805,7 +805,9 @@ class TestAccountsController(FrappeTestCase):
self.assertEqual(exc_je_for_si, []) self.assertEqual(exc_je_for_si, [])
self.assertEqual(exc_je_for_pe, []) self.assertEqual(exc_je_for_pe, [])
@change_settings("Stock Settings", {"allow_internal_transfer_at_arms_length_price": 1}) @IntegrationTestCase.change_settings(
"Stock Settings", {"allow_internal_transfer_at_arms_length_price": 1}
)
def test_16_internal_transfer_at_arms_length_price(self): def test_16_internal_transfer_at_arms_length_price(self):
from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse

View File

@@ -1,11 +1,11 @@
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase
from erpnext.accounts.test.accounts_mixin import AccountsTestMixin from erpnext.accounts.test.accounts_mixin import AccountsTestMixin
from erpnext.controllers.taxes_and_totals import calculate_taxes_and_totals from erpnext.controllers.taxes_and_totals import calculate_taxes_and_totals
from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
class TestTaxesAndTotals(AccountsTestMixin, FrappeTestCase): class TestTaxesAndTotals(AccountsTestMixin, IntegrationTestCase):
def test_distributed_discount_amount(self): def test_distributed_discount_amount(self):
so = make_sales_order(do_not_save=1) so = make_sales_order(do_not_save=1)
so.apply_discount_on = "Net Total" so.apply_discount_on = "Net Total"

View File

@@ -4,7 +4,7 @@ import unittest
import frappe import frappe
import frappe.utils import frappe.utils
from frappe.model import mapper from frappe.model import mapper
from frappe.test_runner import make_test_records from frappe.tests.utils import make_test_records
from frappe.utils import add_months, nowdate from frappe.utils import add_months, nowdate

View File

@@ -5,7 +5,7 @@ import copy
from collections import defaultdict from collections import defaultdict
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase
from frappe.utils import cint from frappe.utils import cint
from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order
@@ -25,7 +25,7 @@ from erpnext.subcontracting.doctype.subcontracting_order.subcontracting_order im
) )
class TestSubcontractingController(FrappeTestCase): class TestSubcontractingController(IntegrationTestCase):
def setUp(self): def setUp(self):
make_subcontracted_items() make_subcontracted_items()
make_raw_materials() make_raw_materials()

View File

@@ -1,12 +1,12 @@
import unittest import unittest
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase
from erpnext.crm.report.sales_pipeline_analytics.sales_pipeline_analytics import execute from erpnext.crm.report.sales_pipeline_analytics.sales_pipeline_analytics import execute
class TestSalesPipelineAnalytics(FrappeTestCase): class TestSalesPipelineAnalytics(IntegrationTestCase):
def setUp(self): def setUp(self):
frappe.db.delete("Opportunity") frappe.db.delete("Opportunity")
create_company() create_company()

View File

@@ -1,7 +1,7 @@
# 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 frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
from frappe.utils import add_months, today from frappe.utils import add_months, today
from erpnext import get_company_currency from erpnext import get_company_currency
@@ -10,7 +10,16 @@ from erpnext.stock.doctype.item.test_item import make_item
from .blanket_order import make_order from .blanket_order import make_order
class TestBlanketOrder(FrappeTestCase): class UnitTestBlanketOrder(UnitTestCase):
"""
Unit tests for BlanketOrder.
Use this class for testing individual functions and methods.
"""
pass
class TestBlanketOrder(IntegrationTestCase):
def setUp(self): def setUp(self):
frappe.flags.args = frappe._dict() frappe.flags.args = frappe._dict()

View File

@@ -6,7 +6,8 @@ from collections import deque
from functools import partial from functools import partial
import frappe import frappe
from frappe.tests.utils import FrappeTestCase, timeout from frappe.tests import IntegrationTestCase, UnitTestCase
from frappe.tests.utils import timeout
from frappe.utils import cstr, flt from frappe.utils import cstr, flt
from erpnext.controllers.tests.test_subcontracting_controller import ( from erpnext.controllers.tests.test_subcontracting_controller import (
@@ -25,7 +26,16 @@ test_records = frappe.get_test_records("BOM")
test_dependencies = ["Item", "Quality Inspection Template"] test_dependencies = ["Item", "Quality Inspection Template"]
class TestBOM(FrappeTestCase): class UnitTestBom(UnitTestCase):
"""
Unit tests for Bom.
Use this class for testing individual functions and methods.
"""
pass
class TestBOM(IntegrationTestCase):
@timeout @timeout
def test_get_items(self): def test_get_items(self):
from erpnext.manufacturing.doctype.bom.bom import get_bom_items_as_dict from erpnext.manufacturing.doctype.bom.bom import get_bom_items_as_dict

View File

@@ -4,7 +4,7 @@
import random import random
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
from erpnext.manufacturing.doctype.bom_creator.bom_creator import ( from erpnext.manufacturing.doctype.bom_creator.bom_creator import (
add_item, add_item,
@@ -13,7 +13,16 @@ from erpnext.manufacturing.doctype.bom_creator.bom_creator import (
from erpnext.stock.doctype.item.test_item import make_item from erpnext.stock.doctype.item.test_item import make_item
class TestBOMCreator(FrappeTestCase): class UnitTestBomCreator(UnitTestCase):
"""
Unit tests for BomCreator.
Use this class for testing individual functions and methods.
"""
pass
class TestBOMCreator(IntegrationTestCase):
def setUp(self) -> None: def setUp(self) -> None:
create_items() create_items()

View File

@@ -2,7 +2,7 @@
# See license.txt # See license.txt
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
from erpnext.manufacturing.doctype.bom_update_log.bom_update_log import ( from erpnext.manufacturing.doctype.bom_update_log.bom_update_log import (
BOMMissingError, BOMMissingError,
@@ -16,7 +16,16 @@ from erpnext.manufacturing.doctype.bom_update_tool.bom_update_tool import (
test_records = frappe.get_test_records("BOM") test_records = frappe.get_test_records("BOM")
class TestBOMUpdateLog(FrappeTestCase): class UnitTestBomUpdateLog(UnitTestCase):
"""
Unit tests for BomUpdateLog.
Use this class for testing individual functions and methods.
"""
pass
class TestBOMUpdateLog(IntegrationTestCase):
"Test BOM Update Tool Operations via BOM Update Log." "Test BOM Update Tool Operations via BOM Update Log."
def setUp(self): def setUp(self):

View File

@@ -2,7 +2,8 @@
# License: GNU General Public License v3. See license.txt # License: GNU General Public License v3. See license.txt
import frappe import frappe
from frappe.tests.utils import FrappeTestCase, timeout from frappe.tests import IntegrationTestCase, UnitTestCase
from frappe.tests.utils import timeout
from erpnext.manufacturing.doctype.bom_update_log.test_bom_update_log import ( from erpnext.manufacturing.doctype.bom_update_log.test_bom_update_log import (
update_cost_in_all_boms_in_test, update_cost_in_all_boms_in_test,
@@ -14,7 +15,16 @@ from erpnext.stock.doctype.item.test_item import create_item
test_records = frappe.get_test_records("BOM") test_records = frappe.get_test_records("BOM")
class TestBOMUpdateTool(FrappeTestCase): class UnitTestBomUpdateTool(UnitTestCase):
"""
Unit tests for BomUpdateTool.
Use this class for testing individual functions and methods.
"""
pass
class TestBOMUpdateTool(IntegrationTestCase):
"Test major functions run via BOM Update Tool." "Test major functions run via BOM Update Tool."
def tearDown(self): def tearDown(self):

View File

@@ -5,8 +5,8 @@
from typing import Literal from typing import Literal
import frappe import frappe
from frappe.test_runner import make_test_records from frappe.tests import IntegrationTestCase, UnitTestCase
from frappe.tests.utils import FrappeTestCase, change_settings from frappe.tests.utils import make_test_records
from frappe.utils import random_string from frappe.utils import random_string
from frappe.utils.data import add_to_date, now, today from frappe.utils.data import add_to_date, now, today
@@ -26,7 +26,16 @@ from erpnext.manufacturing.doctype.workstation.test_workstation import make_work
from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
class TestJobCard(FrappeTestCase): class UnitTestJobCard(UnitTestCase):
"""
Unit tests for JobCard.
Use this class for testing individual functions and methods.
"""
pass
class TestJobCard(IntegrationTestCase):
def setUp(self): def setUp(self):
make_bom_for_jc_tests() make_bom_for_jc_tests()
self.transfer_material_against: Literal["Work Order", "Job Card"] = "Work Order" self.transfer_material_against: Literal["Work Order", "Job Card"] = "Work Order"
@@ -206,7 +215,7 @@ class TestJobCard(FrappeTestCase):
# transfer was made for 2 fg qty in first transfer Stock Entry # transfer was made for 2 fg qty in first transfer Stock Entry
self.assertEqual(transfer_entry_2.fg_completed_qty, 0) self.assertEqual(transfer_entry_2.fg_completed_qty, 0)
@change_settings("Manufacturing Settings", {"job_card_excess_transfer": 1}) @IntegrationTestCase.change_settings("Manufacturing Settings", {"job_card_excess_transfer": 1})
def test_job_card_excess_material_transfer(self): def test_job_card_excess_material_transfer(self):
"Test transferring more than required RM against Job Card." "Test transferring more than required RM against Job Card."
self.transfer_material_against = "Job Card" self.transfer_material_against = "Job Card"
@@ -249,7 +258,7 @@ class TestJobCard(FrappeTestCase):
# JC is Completed with excess transfer # JC is Completed with excess transfer
self.assertEqual(job_card.status, "Completed") self.assertEqual(job_card.status, "Completed")
@change_settings("Manufacturing Settings", {"job_card_excess_transfer": 0}) @IntegrationTestCase.change_settings("Manufacturing Settings", {"job_card_excess_transfer": 0})
def test_job_card_excess_material_transfer_block(self): def test_job_card_excess_material_transfer_block(self):
self.transfer_material_against = "Job Card" self.transfer_material_against = "Job Card"
self.source_warehouse = "Stores - _TC" self.source_warehouse = "Stores - _TC"
@@ -272,7 +281,7 @@ class TestJobCard(FrappeTestCase):
transfer_entry_2.insert() transfer_entry_2.insert()
self.assertRaises(JobCardOverTransferError, transfer_entry_2.submit) self.assertRaises(JobCardOverTransferError, transfer_entry_2.submit)
@change_settings("Manufacturing Settings", {"job_card_excess_transfer": 0}) @IntegrationTestCase.change_settings("Manufacturing Settings", {"job_card_excess_transfer": 0})
def test_job_card_excess_material_transfer_with_no_reference(self): def test_job_card_excess_material_transfer_with_no_reference(self):
self.transfer_material_against = "Job Card" self.transfer_material_against = "Job Card"
self.source_warehouse = "Stores - _TC" self.source_warehouse = "Stores - _TC"
@@ -380,7 +389,7 @@ class TestJobCard(FrappeTestCase):
self.assertEqual(transfer_entry.items[0].item_code, "_Test Item") self.assertEqual(transfer_entry.items[0].item_code, "_Test Item")
self.assertEqual(transfer_entry.items[0].qty, 2) self.assertEqual(transfer_entry.items[0].qty, 2)
@change_settings( @IntegrationTestCase.change_settings(
"Manufacturing Settings", {"add_corrective_operation_cost_in_finished_good_valuation": 1} "Manufacturing Settings", {"add_corrective_operation_cost_in_finished_good_valuation": 1}
) )
def test_corrective_costing(self): def test_corrective_costing(self):

View File

@@ -2,8 +2,17 @@
# See license.txt # See license.txt
# import frappe # import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
class TestPlantFloor(FrappeTestCase): class UnitTestPlantFloor(UnitTestCase):
"""
Unit tests for PlantFloor.
Use this class for testing individual functions and methods.
"""
pass
class TestPlantFloor(IntegrationTestCase):
pass pass

View File

@@ -1,7 +1,7 @@
# 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 frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
from frappe.utils import add_to_date, flt, getdate, now_datetime, nowdate from frappe.utils import add_to_date, flt, getdate, now_datetime, nowdate
from erpnext.controllers.item_variant import create_variant from erpnext.controllers.item_variant import create_variant
@@ -22,7 +22,16 @@ from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation import
) )
class TestProductionPlan(FrappeTestCase): class UnitTestProductionPlan(UnitTestCase):
"""
Unit tests for ProductionPlan.
Use this class for testing individual functions and methods.
"""
pass
class TestProductionPlan(IntegrationTestCase):
def setUp(self): def setUp(self):
for item in [ for item in [
"Test Production Item 1", "Test Production Item 1",

View File

@@ -1,15 +1,24 @@
# 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 frappe import frappe
from frappe.test_runner import make_test_records from frappe.tests import IntegrationTestCase, UnitTestCase
from frappe.tests.utils import FrappeTestCase from frappe.tests.utils import make_test_records
from erpnext.manufacturing.doctype.job_card.job_card import OperationSequenceError from erpnext.manufacturing.doctype.job_card.job_card import OperationSequenceError
from erpnext.manufacturing.doctype.work_order.test_work_order import make_wo_order_test_record from erpnext.manufacturing.doctype.work_order.test_work_order import make_wo_order_test_record
from erpnext.stock.doctype.item.test_item import make_item from erpnext.stock.doctype.item.test_item import make_item
class TestRouting(FrappeTestCase): class UnitTestRouting(UnitTestCase):
"""
Unit tests for Routing.
Use this class for testing individual functions and methods.
"""
pass
class TestRouting(IntegrationTestCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
cls.item_code = "Test Routing Item - A" cls.item_code = "Test Routing Item - A"

View File

@@ -3,7 +3,8 @@
import frappe import frappe
from frappe.tests.utils import FrappeTestCase, change_settings, timeout from frappe.tests import IntegrationTestCase, UnitTestCase
from frappe.tests.utils import timeout
from frappe.utils import add_days, add_months, add_to_date, cint, flt, now, today from frappe.utils import add_days, add_months, add_to_date, cint, flt, now, today
from erpnext.manufacturing.doctype.job_card.job_card import JobCardCancelError from erpnext.manufacturing.doctype.job_card.job_card import JobCardCancelError
@@ -34,7 +35,16 @@ from erpnext.stock.utils import get_bin
test_dependencies = ["BOM"] test_dependencies = ["BOM"]
class TestWorkOrder(FrappeTestCase): class UnitTestWorkOrder(UnitTestCase):
"""
Unit tests for WorkOrder.
Use this class for testing individual functions and methods.
"""
pass
class TestWorkOrder(IntegrationTestCase):
def setUp(self): def setUp(self):
self.warehouse = "_Test Warehouse 2 - _TC" self.warehouse = "_Test Warehouse 2 - _TC"
self.item = "_Test Item" self.item = "_Test Item"
@@ -1142,7 +1152,9 @@ class TestWorkOrder(FrappeTestCase):
frappe.db.set_single_value("Manufacturing Settings", "backflush_raw_materials_based_on", "BOM") frappe.db.set_single_value("Manufacturing Settings", "backflush_raw_materials_based_on", "BOM")
@change_settings("Manufacturing Settings", {"make_serial_no_batch_from_work_order": 1}) @IntegrationTestCase.change_settings(
"Manufacturing Settings", {"make_serial_no_batch_from_work_order": 1}
)
def test_auto_batch_creation(self): def test_auto_batch_creation(self):
from erpnext.manufacturing.doctype.bom.test_bom import create_nested_bom from erpnext.manufacturing.doctype.bom.test_bom import create_nested_bom
@@ -1163,7 +1175,9 @@ class TestWorkOrder(FrappeTestCase):
except frappe.MandatoryError: except frappe.MandatoryError:
self.fail("Batch generation causing failing in Work Order") self.fail("Batch generation causing failing in Work Order")
@change_settings("Manufacturing Settings", {"make_serial_no_batch_from_work_order": 1}) @IntegrationTestCase.change_settings(
"Manufacturing Settings", {"make_serial_no_batch_from_work_order": 1}
)
def test_auto_serial_no_creation(self): def test_auto_serial_no_creation(self):
from erpnext.manufacturing.doctype.bom.test_bom import create_nested_bom from erpnext.manufacturing.doctype.bom.test_bom import create_nested_bom
@@ -1196,7 +1210,9 @@ class TestWorkOrder(FrappeTestCase):
except frappe.MandatoryError: except frappe.MandatoryError:
self.fail("Batch generation causing failing in Work Order") self.fail("Batch generation causing failing in Work Order")
@change_settings("Manufacturing Settings", {"make_serial_no_batch_from_work_order": 1}) @IntegrationTestCase.change_settings(
"Manufacturing Settings", {"make_serial_no_batch_from_work_order": 1}
)
def test_auto_serial_no_batch_creation(self): def test_auto_serial_no_batch_creation(self):
from erpnext.manufacturing.doctype.bom.test_bom import create_nested_bom from erpnext.manufacturing.doctype.bom.test_bom import create_nested_bom
@@ -1248,7 +1264,7 @@ class TestWorkOrder(FrappeTestCase):
return serial_nos return serial_nos
@change_settings( @IntegrationTestCase.change_settings(
"Manufacturing Settings", "Manufacturing Settings",
{"backflush_raw_materials_based_on": "Material Transferred for Manufacture"}, {"backflush_raw_materials_based_on": "Material Transferred for Manufacture"},
) )
@@ -1278,7 +1294,7 @@ class TestWorkOrder(FrappeTestCase):
for index, row in enumerate(ste_manu.get("items"), start=1): for index, row in enumerate(ste_manu.get("items"), start=1):
self.assertEqual(index, row.idx) self.assertEqual(index, row.idx)
@change_settings( @IntegrationTestCase.change_settings(
"Manufacturing Settings", "Manufacturing Settings",
{"backflush_raw_materials_based_on": "Material Transferred for Manufacture"}, {"backflush_raw_materials_based_on": "Material Transferred for Manufacture"},
) )
@@ -2061,7 +2077,7 @@ class TestWorkOrder(FrappeTestCase):
frappe.db.set_single_value("Manufacturing Settings", "set_op_cost_and_scrape_from_sub_assemblies", 0) frappe.db.set_single_value("Manufacturing Settings", "set_op_cost_and_scrape_from_sub_assemblies", 0)
@change_settings( @IntegrationTestCase.change_settings(
"Manufacturing Settings", {"material_consumption": 1, "get_rm_cost_from_consumption_entry": 1} "Manufacturing Settings", {"material_consumption": 1, "get_rm_cost_from_consumption_entry": 1}
) )
def test_get_rm_cost_from_consumption_entry(self): def test_get_rm_cost_from_consumption_entry(self):

View File

@@ -1,8 +1,8 @@
# 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 frappe import frappe
from frappe.test_runner import make_test_records from frappe.tests import IntegrationTestCase, UnitTestCase
from frappe.tests.utils import FrappeTestCase from frappe.tests.utils import make_test_records
from erpnext.manufacturing.doctype.operation.test_operation import make_operation from erpnext.manufacturing.doctype.operation.test_operation import make_operation
from erpnext.manufacturing.doctype.routing.test_routing import create_routing, setup_bom from erpnext.manufacturing.doctype.routing.test_routing import create_routing, setup_bom
@@ -17,7 +17,16 @@ test_records = frappe.get_test_records("Workstation")
make_test_records("Workstation") make_test_records("Workstation")
class TestWorkstation(FrappeTestCase): class UnitTestWorkstation(UnitTestCase):
"""
Unit tests for Workstation.
Use this class for testing individual functions and methods.
"""
pass
class TestWorkstation(IntegrationTestCase):
def test_validate_timings(self): def test_validate_timings(self):
check_if_within_operating_hours( check_if_within_operating_hours(
"_Test Workstation 1", "Operation 1", "2013-02-02 11:00:00", "2013-02-02 19:00:00" "_Test Workstation 1", "Operation 1", "2013-02-02 11:00:00", "2013-02-02 19:00:00"

View File

@@ -2,10 +2,19 @@
# See license.txt # See license.txt
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
class TestWorkstationType(FrappeTestCase): class UnitTestWorkstationType(UnitTestCase):
"""
Unit tests for WorkstationType.
Use this class for testing individual functions and methods.
"""
pass
class TestWorkstationType(IntegrationTestCase):
pass pass

View File

@@ -1,7 +1,7 @@
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt # For license information, please see license.txt
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase
from erpnext.manufacturing.doctype.production_plan.test_production_plan import make_bom from erpnext.manufacturing.doctype.production_plan.test_production_plan import make_bom
from erpnext.manufacturing.report.bom_stock_calculated.bom_stock_calculated import ( from erpnext.manufacturing.report.bom_stock_calculated.bom_stock_calculated import (
@@ -10,7 +10,7 @@ from erpnext.manufacturing.report.bom_stock_calculated.bom_stock_calculated impo
from erpnext.stock.doctype.item.test_item import make_item from erpnext.stock.doctype.item.test_item import make_item
class TestBOMStockCalculated(FrappeTestCase): class TestBOMStockCalculated(IntegrationTestCase):
def setUp(self): def setUp(self):
self.fg_item, self.rm_items = create_items() self.fg_item, self.rm_items = create_items()
self.boms = create_boms(self.fg_item, self.rm_items) self.boms = create_boms(self.fg_item, self.rm_items)

View File

@@ -4,7 +4,7 @@
import frappe import frappe
from frappe.exceptions import ValidationError from frappe.exceptions import ValidationError
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase
from frappe.utils import floor from frappe.utils import floor
from erpnext.manufacturing.doctype.production_plan.test_production_plan import make_bom from erpnext.manufacturing.doctype.production_plan.test_production_plan import make_bom
@@ -15,7 +15,7 @@ from erpnext.stock.doctype.item.test_item import make_item
from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry
class TestBomStockReport(FrappeTestCase): class TestBomStockReport(IntegrationTestCase):
def setUp(self): def setUp(self):
self.warehouse = "_Test Warehouse - _TC" self.warehouse = "_Test Warehouse - _TC"
self.fg_item, self.rm_items = create_items() self.fg_item, self.rm_items = create_items()

View File

@@ -2,7 +2,7 @@
# License: GNU General Public License v3. See license.txt # License: GNU General Public License v3. See license.txt
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
from frappe.utils import add_days, getdate, nowdate from frappe.utils import add_days, getdate, nowdate
from erpnext.projects.doctype.project_template.test_project_template import make_project_template from erpnext.projects.doctype.project_template.test_project_template import make_project_template
@@ -14,7 +14,16 @@ test_records = frappe.get_test_records("Project")
test_ignore = ["Sales Order"] test_ignore = ["Sales Order"]
class TestProject(FrappeTestCase): class UnitTestProject(UnitTestCase):
"""
Unit tests for Project.
Use this class for testing individual functions and methods.
"""
pass
class TestProject(IntegrationTestCase):
def test_project_with_template_having_no_parent_and_depend_tasks(self): def test_project_with_template_having_no_parent_and_depend_tasks(self):
project_name = "Test Project with Template - No Parent and Dependend Tasks" project_name = "Test Project with Template - No Parent and Dependend Tasks"
frappe.db.sql(""" delete from tabTask where project = %s """, project_name) frappe.db.sql(""" delete from tabTask where project = %s """, project_name)

View File

@@ -2,12 +2,21 @@
# See license.txt # See license.txt
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
from .quality_procedure import add_node from .quality_procedure import add_node
class TestQualityProcedure(FrappeTestCase): class UnitTestQualityProcedure(UnitTestCase):
"""
Unit tests for QualityProcedure.
Use this class for testing individual functions and methods.
"""
pass
class TestQualityProcedure(IntegrationTestCase):
def test_add_node(self): def test_add_node(self):
procedure = create_procedure( procedure = create_procedure(
{ {

View File

@@ -5,8 +5,8 @@
import json import json
import frappe import frappe
from frappe.test_runner import make_test_records from frappe.tests import IntegrationTestCase, UnitTestCase
from frappe.tests.utils import FrappeTestCase from frappe.tests.utils import make_test_records
from frappe.utils import flt from frappe.utils import flt
from erpnext.accounts.party import get_due_date from erpnext.accounts.party import get_due_date
@@ -23,7 +23,16 @@ test_dependencies = ["Payment Term", "Payment Terms Template"]
test_records = frappe.get_test_records("Customer") test_records = frappe.get_test_records("Customer")
class TestCustomer(FrappeTestCase): class UnitTestCustomer(UnitTestCase):
"""
Unit tests for Customer.
Use this class for testing individual functions and methods.
"""
pass
class TestCustomer(IntegrationTestCase):
def setUp(self): def setUp(self):
if not frappe.get_value("Item", "_Test Item"): if not frappe.get_value("Item", "_Test Item"):
make_test_records("Item") make_test_records("Item")

View File

@@ -2,7 +2,7 @@
# See license.txt # See license.txt
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
from erpnext.controllers.queries import item_query from erpnext.controllers.queries import item_query
@@ -18,7 +18,16 @@ def create_party_specific_item(**args):
psi.insert() psi.insert()
class TestPartySpecificItem(FrappeTestCase): class UnitTestPartySpecificItem(UnitTestCase):
"""
Unit tests for PartySpecificItem.
Use this class for testing individual functions and methods.
"""
pass
class TestPartySpecificItem(IntegrationTestCase):
def setUp(self): def setUp(self):
self.customer = frappe.get_last_doc("Customer") self.customer = frappe.get_last_doc("Customer")
self.supplier = frappe.get_last_doc("Supplier") self.supplier = frappe.get_last_doc("Supplier")

View File

@@ -2,7 +2,7 @@
# License: GNU General Public License v3. See license.txt # License: GNU General Public License v3. See license.txt
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
from frappe.utils import add_days, add_months, flt, getdate, nowdate from frappe.utils import add_days, add_months, flt, getdate, nowdate
from erpnext.controllers.accounts_controller import InvalidQtyError from erpnext.controllers.accounts_controller import InvalidQtyError
@@ -10,7 +10,16 @@ from erpnext.controllers.accounts_controller import InvalidQtyError
test_dependencies = ["Product Bundle"] test_dependencies = ["Product Bundle"]
class TestQuotation(FrappeTestCase): class UnitTestQuotation(UnitTestCase):
"""
Unit tests for Quotation.
Use this class for testing individual functions and methods.
"""
pass
class TestQuotation(IntegrationTestCase):
def test_quotation_qty(self): def test_quotation_qty(self):
qo = make_quotation(qty=0, do_not_save=True) qo = make_quotation(qty=0, do_not_save=True)
with self.assertRaises(InvalidQtyError): with self.assertRaises(InvalidQtyError):

View File

@@ -7,7 +7,7 @@ from unittest.mock import patch
import frappe import frappe
import frappe.permissions import frappe.permissions
from frappe.core.doctype.user_permission.test_user_permission import create_user from frappe.core.doctype.user_permission.test_user_permission import create_user
from frappe.tests.utils import FrappeTestCase, change_settings from frappe.tests import IntegrationTestCase
from frappe.utils import add_days, flt, getdate, nowdate, today from frappe.utils import add_days, flt, getdate, nowdate, today
from erpnext.accounts.test.accounts_mixin import AccountsTestMixin from erpnext.accounts.test.accounts_mixin import AccountsTestMixin
@@ -33,7 +33,7 @@ from erpnext.stock.doctype.item.test_item import make_item
from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
class TestSalesOrder(AccountsTestMixin, FrappeTestCase): class TestSalesOrder(AccountsTestMixin, IntegrationTestCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super().setUpClass() super().setUpClass()
@@ -1316,7 +1316,9 @@ class TestSalesOrder(AccountsTestMixin, FrappeTestCase):
self.assertRaises(frappe.LinkExistsError, so_doc.cancel) self.assertRaises(frappe.LinkExistsError, so_doc.cancel)
@change_settings("Accounts Settings", {"unlink_advance_payment_on_cancelation_of_order": 1}) @IntegrationTestCase.change_settings(
"Accounts Settings", {"unlink_advance_payment_on_cancelation_of_order": 1}
)
def test_advance_paid_upon_payment_cancellation(self): def test_advance_paid_upon_payment_cancellation(self):
from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_payment_entry from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_payment_entry
@@ -1906,7 +1908,7 @@ class TestSalesOrder(AccountsTestMixin, FrappeTestCase):
self.assertEqual(len(dn.packed_items), 1) self.assertEqual(len(dn.packed_items), 1)
self.assertEqual(dn.items[0].item_code, "_Test Product Bundle Item Partial 2") self.assertEqual(dn.items[0].item_code, "_Test Product Bundle Item Partial 2")
@change_settings("Selling Settings", {"editable_bundle_item_rates": 1}) @IntegrationTestCase.change_settings("Selling Settings", {"editable_bundle_item_rates": 1})
def test_expired_rate_for_packed_item(self): def test_expired_rate_for_packed_item(self):
bundle = "_Test Product Bundle 1" bundle = "_Test Product Bundle 1"
packed_item = "_Packed Item 1" packed_item = "_Packed Item 1"
@@ -2198,7 +2200,7 @@ class TestSalesOrder(AccountsTestMixin, FrappeTestCase):
self.assertRaises(frappe.ValidationError, so1.update_status, "Draft") self.assertRaises(frappe.ValidationError, so1.update_status, "Draft")
@change_settings("Stock Settings", {"enable_stock_reservation": True}) @IntegrationTestCase.change_settings("Stock Settings", {"enable_stock_reservation": True})
def test_warehouse_mapping_based_on_stock_reservation(self): def test_warehouse_mapping_based_on_stock_reservation(self):
self.create_company(company_name="Glass Ceiling", abbr="GC") self.create_company(company_name="Glass Ceiling", abbr="GC")
self.create_item("Lamy Safari 2", True, self.warehouse_stores, self.company, 2000) self.create_item("Lamy Safari 2", True, self.warehouse_stores, self.company, 2000)

View File

@@ -1,7 +1,7 @@
import datetime import datetime
import frappe import frappe
from frappe.tests.utils import FrappeTestCase 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.selling.doctype.sales_order.sales_order import make_sales_invoice from erpnext.selling.doctype.sales_order.sales_order import make_sales_invoice
@@ -14,7 +14,7 @@ from erpnext.stock.doctype.item.test_item import create_item
test_dependencies = ["Sales Order", "Item", "Sales Invoice", "Payment Terms Template", "Customer"] test_dependencies = ["Sales Order", "Item", "Sales Invoice", "Payment Terms Template", "Customer"]
class TestPaymentTermsStatusForSalesOrder(FrappeTestCase): class TestPaymentTermsStatusForSalesOrder(IntegrationTestCase):
def setUp(self): def setUp(self):
self.cleanup_old_entries() self.cleanup_old_entries()

View File

@@ -2,7 +2,7 @@
# For license information, please see license.txt # For license information, please see license.txt
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase
from frappe.utils import add_months, nowdate from frappe.utils import add_months, nowdate
from erpnext.selling.doctype.sales_order.sales_order import make_material_request from erpnext.selling.doctype.sales_order.sales_order import make_material_request
@@ -12,7 +12,7 @@ from erpnext.selling.report.pending_so_items_for_purchase_request.pending_so_ite
) )
class TestPendingSOItemsForPurchaseRequest(FrappeTestCase): class TestPendingSOItemsForPurchaseRequest(IntegrationTestCase):
def test_result_for_partial_material_request(self): def test_result_for_partial_material_request(self):
so = make_sales_order() so = make_sales_order()
mr = make_material_request(so.name) mr = make_material_request(so.name)

View File

@@ -3,13 +3,13 @@
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase
from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
from erpnext.selling.report.sales_analytics.sales_analytics import execute from erpnext.selling.report.sales_analytics.sales_analytics import execute
class TestAnalytics(FrappeTestCase): class TestAnalytics(IntegrationTestCase):
def test_sales_analytics(self): def test_sales_analytics(self):
frappe.db.sql("delete from `tabSales Order` where company='_Test Company 2'") frappe.db.sql("delete from `tabSales Order` where company='_Test Company 2'")

View File

@@ -1,5 +1,5 @@
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase
from frappe.utils import add_days from frappe.utils import add_days
from erpnext.selling.doctype.sales_order.sales_order import make_delivery_note, make_sales_invoice from erpnext.selling.doctype.sales_order.sales_order import make_delivery_note, make_sales_invoice
@@ -10,7 +10,7 @@ from erpnext.stock.doctype.item.test_item import create_item
test_dependencies = ["Sales Order", "Item", "Sales Invoice", "Delivery Note"] test_dependencies = ["Sales Order", "Item", "Sales Invoice", "Delivery Note"]
class TestSalesOrderAnalysis(FrappeTestCase): class TestSalesOrderAnalysis(IntegrationTestCase):
def create_sales_order(self, transaction_date, do_not_save=False, do_not_submit=False): def create_sales_order(self, transaction_date, do_not_save=False, do_not_submit=False):
item = create_item(item_code="_Test Excavator", is_stock_item=0) item = create_item(item_code="_Test Excavator", is_stock_item=0)
so = make_sales_order( so = make_sales_order(

View File

@@ -1,5 +1,5 @@
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase
from frappe.utils import flt, nowdate from frappe.utils import flt, 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
@@ -13,7 +13,7 @@ from erpnext.selling.report.sales_person_target_variance_based_on_item_group.tes
) )
class TestSalesPartnerTargetVarianceBasedOnItemGroup(FrappeTestCase): class TestSalesPartnerTargetVarianceBasedOnItemGroup(IntegrationTestCase):
def setUp(self): def setUp(self):
self.fiscal_year = get_fiscal_year(nowdate())[0] self.fiscal_year = get_fiscal_year(nowdate())[0]

View File

@@ -1,5 +1,5 @@
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase
from frappe.utils import flt, nowdate from frappe.utils import flt, nowdate
from erpnext.accounts.utils import get_fiscal_year from erpnext.accounts.utils import get_fiscal_year
@@ -9,7 +9,7 @@ from erpnext.selling.report.sales_person_target_variance_based_on_item_group.sal
) )
class TestSalesPersonTargetVarianceBasedOnItemGroup(FrappeTestCase): class TestSalesPersonTargetVarianceBasedOnItemGroup(IntegrationTestCase):
def setUp(self): def setUp(self):
self.fiscal_year = get_fiscal_year(nowdate())[0] self.fiscal_year = get_fiscal_year(nowdate())[0]

View File

@@ -2,8 +2,17 @@
# See license.txt # See license.txt
# import frappe # import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
class TestIncoterm(FrappeTestCase): class UnitTestIncoterm(UnitTestCase):
"""
Unit tests for Incoterm.
Use this class for testing individual functions and methods.
"""
pass
class TestIncoterm(IntegrationTestCase):
pass pass

View File

@@ -3,10 +3,19 @@
import frappe import frappe
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
class TestTransactionDeletionRecord(FrappeTestCase): class UnitTestTransactionDeletionRecord(UnitTestCase):
"""
Unit tests for TransactionDeletionRecord.
Use this class for testing individual functions and methods.
"""
pass
class TestTransactionDeletionRecord(IntegrationTestCase):
def setUp(self): def setUp(self):
create_company("Dunder Mifflin Paper Co") create_company("Dunder Mifflin Paper Co")

View File

@@ -5,7 +5,7 @@ import json
import frappe import frappe
from frappe.exceptions import ValidationError from frappe.exceptions import ValidationError
from frappe.tests.utils import FrappeTestCase from frappe.tests import IntegrationTestCase, UnitTestCase
from frappe.utils import cint, flt from frappe.utils import cint, flt
from frappe.utils.data import add_to_date, getdate from frappe.utils.data import add_to_date, getdate
@@ -24,7 +24,16 @@ from erpnext.stock.get_item_details import get_item_details
from erpnext.stock.serial_batch_bundle import SerialBatchCreation from erpnext.stock.serial_batch_bundle import SerialBatchCreation
class TestBatch(FrappeTestCase): class UnitTestBatch(UnitTestCase):
"""
Unit tests for Batch.
Use this class for testing individual functions and methods.
"""
pass
class TestBatch(IntegrationTestCase):
def test_item_has_batch_enabled(self): def test_item_has_batch_enabled(self):
self.assertRaises( self.assertRaises(
ValidationError, ValidationError,

Some files were not shown because too many files have changed in this diff Show More