Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Fix calling get_client_token for Braintree
Marcin Gębalacdb355cdb273
diff --git a/saleor/payment/gateways/braintree/__init__.py b/saleor/payment/gateways/braintree/__init__.pyindex 58ff9f23ab..cf034f03b4 100644--- a/saleor/payment/gateways/braintree/__init__.py+++ b/saleor/payment/gateways/braintree/__init__.py@@ -1,5 +1,5 @@import logging-from typing import Any, Dict, List+from typing import Dict, Listimport braintree as braintree_sdkfrom django.core.exceptions import ImproperlyConfigured@@ -109,8 +109,8 @@ def get_braintree_gateway(sandbox_mode, merchant_id, public_key, private_key):return gateway-def get_client_token(connection_params: Dict[str, Any]) -> str:- gateway = get_braintree_gateway(**connection_params)+def get_client_token(config: GatewayConfig) -> str:+ gateway = get_braintree_gateway(**config.connection_params)client_token = gateway.client_token.generate()return client_tokendiff --git a/tests/gateway/test_braintree.py b/tests/gateway/test_braintree.pyindex 2fd242ab73..974518222b 100644--- a/tests/gateway/test_braintree.py+++ b/tests/gateway/test_braintree.py@@ -205,7 +205,7 @@ def test_get_client_token(mock_gateway, gateway_config):client_token = "client-token"mock_generate = Mock(return_value="client-token")mock_gateway.return_value = Mock(client_token=Mock(generate=mock_generate))- result = get_client_token(gateway_config.connection_params)+ result = get_client_token(gateway_config)mock_gateway.assert_called_once_with(**gateway_config.connection_params)mock_generate.assert_called_once_with()assert result == client_token