Skip to content

Commit

Permalink
test(payments): use test record loader
Browse files Browse the repository at this point in the history
  • Loading branch information
blaggacao committed Oct 30, 2023
1 parent e752f8f commit af0e611
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 30 deletions.
30 changes: 0 additions & 30 deletions erpnext/accounts/doctype/payment_request/test_payment_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,8 @@

test_dependencies = ["Currency Exchange", "Journal Entry", "Contact", "Address"]

payment_gateway = {"doctype": "Payment Gateway", "gateway": "_Test Gateway"}

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.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
Expand Down
19 changes: 19 additions & 0 deletions erpnext/accounts/doctype/payment_request/test_records.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[
{
"doctype": "Payment Gateway",
"gateway": "_Test Gateway"
},
{
"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"
}
]

0 comments on commit af0e611

Please sign in to comment.