diff --git a/erpnext/accounts/doctype/payment_request/test_payment_request.py b/erpnext/accounts/doctype/payment_request/test_payment_request.py index ee76ce94d934..2d656cfa2465 100644 --- a/erpnext/accounts/doctype/payment_request/test_payment_request.py +++ b/erpnext/accounts/doctype/payment_request/test_payment_request.py @@ -13,62 +13,8 @@ test_dependencies = ["Currency Exchange", "Journal Entry", "Contact", "Address"] -payment_gateway_settings = { - "doctype": "DocType", - "module": "Accounts", - "custom": 1, - "fields": [{"label": "Name", "fieldname": "name", "fieldtype": "Data"}], - "name": "Test Gateway Settings", -} - -payment_gateway_controller = { - "doctype": "Test Gateway Settings", - "name": "_Test Gateway Controller", -} - -payment_gateway = { - "doctype": "Payment Gateway", - "gateway": "_Test Gateway", - "gateway_settings": payment_gateway_settings_doctype["name"], - "gateway_controller": payment_gateway_settings["name"], -} - -payment_method = [ - { - "doctype": "Payment Gateway Account", - "is_default": 1, - "payment_gateway": "_Test Gateway", - "payment_account": "_Test Bank - _TC", - "currency": "INR", - }, - { - "doctype": "Payment Gateway Account", - "payment_gateway": "_Test Gateway", - "payment_account": "_Test Bank USD - _TC", - "currency": "USD", - }, -] - class TestPaymentRequest(unittest.TestCase): - def setUp(self): - if not frappe.db.exists("DocType", payment_gateway_settings["name"]): - frappe.get_doc(payment_gateway_settings).insert(ignore_permissions=True) - - if not frappe.db.exists(payment_gateway_settings["name"], payment_gateway_controller["name"]): - frappe.get_doc(payment_gateway_controller).insert(ignore_permissions=True) - - if not frappe.db.get_value("Payment Gateway", payment_gateway["gateway"], "name"): - frappe.get_doc(payment_gateway).insert(ignore_permissions=True) - - for method in payment_method: - if not frappe.db.get_value( - "Payment Gateway Account", - {"payment_gateway": method["payment_gateway"], "currency": method["currency"]}, - "name", - ): - frappe.get_doc(method).insert(ignore_permissions=True) - def test_payment_request_linkings(self): so_inr = make_sales_order(currency="INR", do_not_save=True) so_inr.disable_rounded_total = 1 diff --git a/erpnext/accounts/doctype/payment_request/test_records.json b/erpnext/accounts/doctype/payment_request/test_records.json new file mode 100644 index 000000000000..bce468c2dd5e --- /dev/null +++ b/erpnext/accounts/doctype/payment_request/test_records.json @@ -0,0 +1,32 @@ +[ + { + "doctype": "DocType", + "module": "Accounts", + "custom": 1, + "fields": [{"label": "Name", "fieldname": "name", "fieldtype": "Data"}], + "name": "Test Gateway Settings" + }, + { + "doctype": "Test Gateway Settings", + "name": "_Test Gateway Controller" + }, + { + "doctype": "Payment Gateway", + "gateway": "_Test Gateway", + "gateway_settings": "Test Gateway Settings", + "gateway_controller": "_Test Gateway Controller" + }, + { + "doctype": "Payment Gateway Account", + "is_default": 1, + "payment_gateway": "_Test Gateway", + "payment_account": "_Test Bank - _TC", + "currency": "INR" + }, + { + "doctype": "Payment Gateway Account", + "payment_gateway": "_Test Gateway", + "payment_account": "_Test Bank USD - _TC", + "currency": "USD" + } +]