refactor: fix failing test cases
This commit is contained in:
@@ -9,6 +9,7 @@ from frappe.custom.doctype.property_setter.property_setter import make_property_
|
|||||||
|
|
||||||
from erpnext.accounts.doctype.accounting_dimension.test_accounting_dimension import (
|
from erpnext.accounts.doctype.accounting_dimension.test_accounting_dimension import (
|
||||||
create_dimension,
|
create_dimension,
|
||||||
|
disable_dimension,
|
||||||
)
|
)
|
||||||
from erpnext.accounts.doctype.opening_invoice_creation_tool.opening_invoice_creation_tool import (
|
from erpnext.accounts.doctype.opening_invoice_creation_tool.opening_invoice_creation_tool import (
|
||||||
get_temporary_opening_account,
|
get_temporary_opening_account,
|
||||||
@@ -20,6 +21,7 @@ class TestOpeningInvoiceCreationTool(unittest.TestCase):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
if not frappe.db.exists("Company", "_Test Opening Invoice Company"):
|
if not frappe.db.exists("Company", "_Test Opening Invoice Company"):
|
||||||
make_company()
|
make_company()
|
||||||
|
create_dimension()
|
||||||
|
|
||||||
def make_invoices(self, invoice_type="Sales", company=None, party_1=None, party_2=None, invoice_number=None, department=None):
|
def make_invoices(self, invoice_type="Sales", company=None, party_1=None, party_2=None, invoice_number=None, department=None):
|
||||||
doc = frappe.get_single("Opening Invoice Creation Tool")
|
doc = frappe.get_single("Opening Invoice Creation Tool")
|
||||||
@@ -110,8 +112,6 @@ class TestOpeningInvoiceCreationTool(unittest.TestCase):
|
|||||||
doc.cancel()
|
doc.cancel()
|
||||||
|
|
||||||
def test_opening_invoice_with_accounting_dimension(self):
|
def test_opening_invoice_with_accounting_dimension(self):
|
||||||
# new dimensions department and location are created
|
|
||||||
create_dimension()
|
|
||||||
invoices = self.make_invoices(invoice_type="Sales", company="_Test Opening Invoice Company", department='Sales - _TOIC')
|
invoices = self.make_invoices(invoice_type="Sales", company="_Test Opening Invoice Company", department='Sales - _TOIC')
|
||||||
|
|
||||||
expected_value = {
|
expected_value = {
|
||||||
@@ -121,6 +121,9 @@ class TestOpeningInvoiceCreationTool(unittest.TestCase):
|
|||||||
}
|
}
|
||||||
self.check_expected_values(invoices, expected_value, invoice_type="Sales")
|
self.check_expected_values(invoices, expected_value, invoice_type="Sales")
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
disable_dimension()
|
||||||
|
|
||||||
def get_opening_invoice_creation_dict(**args):
|
def get_opening_invoice_creation_dict(**args):
|
||||||
party = "Customer" if args.get("invoice_type", "Sales") == "Sales" else "Supplier"
|
party = "Customer" if args.get("invoice_type", "Sales") == "Sales" else "Supplier"
|
||||||
company = args.get("company", "_Test Company")
|
company = args.get("company", "_Test Company")
|
||||||
|
|||||||
Reference in New Issue
Block a user