Skip to content

Commit

Permalink
test: fix some
Browse files Browse the repository at this point in the history
  • Loading branch information
blaggacao committed May 2, 2024
1 parent 037290c commit 662e6a9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions erpnext/accounts/doctype/payment_request/test_payment_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,18 @@ def setUp(self):
self.send_email = send_email.start()
self.addCleanup(send_email.stop)
get_payment_url = patch(
# this also shadows one (1) call to _get_payment_gateway_controller
"erpnext.accounts.doctype.payment_request.payment_request.PaymentRequest.get_payment_url",
# this also shadows one (1) call to _get_payment_controller
"erpnext.accounts.doctype.payment_request.payment_gateway_v1.get_payment_url",
return_value=PAYMENT_URL,
)
self.get_payment_url = get_payment_url.start()
self.addCleanup(get_payment_url.stop)
_get_payment_gateway_controller = patch(
"erpnext.accounts.doctype.payment_request.payment_request._get_payment_gateway_controller",
_get_payment_controller = patch(
"erpnext.accounts.doctype.payment_request.payment_gateway_v1._get_payment_controller",
return_value=Mock(wraps=GatewayControllerInterface()),
)
self._get_payment_gateway_controller = _get_payment_gateway_controller.start()
self.addCleanup(_get_payment_gateway_controller.stop)
self._get_payment_controller = _get_payment_controller.start()
self.addCleanup(_get_payment_controller.stop)

def test_payment_request_linkings(self):
so_inr = make_sales_order(currency="INR", do_not_save=True)
Expand Down Expand Up @@ -171,7 +171,7 @@ def test_payment_channels(self):
pr.cancel()

# a phone controller presumable would override get_payment_url
self._get_payment_gateway_controller().get_payment_url.return_value = None
self._get_payment_controller().get_payment_url.return_value = None

pr = make_payment_request(
dt="Sales Order",
Expand All @@ -190,7 +190,7 @@ def test_payment_channels(self):
pr.cancel()

# restore
self._get_payment_gateway_controller().get_payment_url.return_value = DEFAULT
self._get_payment_controller().get_payment_url.return_value = DEFAULT

pr = make_payment_request(
dt="Sales Order",
Expand Down Expand Up @@ -230,7 +230,7 @@ def test_payment_channels(self):
self.assertEqual(self.send_email.call_count, 1) # no increment on shopping cart
pr.cancel()

self.assertEqual(self._get_payment_gateway_controller().initiate.call_count, 5)
self.assertEqual(self._get_payment_controller().initiate.call_count, 5)

def test_payment_entry_against_purchase_invoice(self):
si_usd = make_purchase_invoice(
Expand Down
4 changes: 2 additions & 2 deletions erpnext/selling/doctype/sales_order/test_sales_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -1958,8 +1958,8 @@ def test_expired_rate_for_packed_item(self):
self.assertEqual(so.packed_items[0].rate, scenario.get("expected_rate"))

@patch(
# this also shadows one (1) call to _get_payment_gateway_controller
"erpnext.accounts.doctype.payment_request.payment_request.PaymentRequest.get_payment_url",
# this also shadows one (1) call to _get_payment_controller
"erpnext.accounts.doctype.payment_request.payment_gateway_v1.get_payment_url",
return_value=None,
)
def test_sales_order_advance_payment_status(self, mocked_get_payment_url):
Expand Down

0 comments on commit 662e6a9

Please sign in to comment.