Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Increase code coverage

Mateusz Grzyba238262a7a91
diff --git a/saleor/payment/gateways/stripe/tests/test_stripe_api.py b/saleor/payment/gateways/stripe/tests/test_stripe_api.py
index 5d50a7c879..42cd3e9ad0 100644
--- a/saleor/payment/gateways/stripe/tests/test_stripe_api.py
+++ b/saleor/payment/gateways/stripe/tests/test_stripe_api.py
@@ -26,6 +26,7 @@ from ..stripe_api import (
refund_payment_intent,
retrieve_payment_intent,
subscribe_webhook,
+ update_payment_method,
)
@@ -171,6 +172,27 @@ def test_create_payment_intent_returns_error(mocked_payment_intent):
assert error
+@patch(
+ "saleor.payment.gateways.stripe.stripe_api.stripe.PaymentMethod",
+)
+def test_update_payment_method(mocked_payment_method):
+ # given
+ api_key = "api_key"
+ payment_method_id = "1234"
+ channel_slug = "channel_slug"
+ metadata = {"key": "value"}
+
+ # when
+ update_payment_method(api_key, payment_method_id, channel_slug, metadata)
+
+ # then
+ mocked_payment_method.modify.assert_called_once_with(
+ payment_method_id,
+ api_key=api_key,
+ metadata={**metadata, "channel": channel_slug},
+ )
+
+
@patch(
"saleor.payment.gateways.stripe.stripe_api.stripe.PaymentIntent",
)