Skip to content

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

Refactor import in payment tests

fowczrek85f229ffd329
diff --git a/saleor/payment/gateways/braintree/tests/test_braintree.py b/saleor/payment/gateways/braintree/tests/test_braintree.py
index bd3181a7b7..e4283e9ef3 100644
--- a/saleor/payment/gateways/braintree/tests/test_braintree.py
+++ b/saleor/payment/gateways/braintree/tests/test_braintree.py
@@ -7,7 +7,9 @@ from braintree.errors import Errors
from braintree.validation_error import ValidationError
from django.core.exceptions import ImproperlyConfigured
-from saleor.payment.gateways.braintree import (
+from ....interface import CreditCardInfo, CustomerSource, GatewayConfig, TokenConfig
+from ....utils import create_payment_information
+from .. import (
TransactionKind,
authorize,
capture,
@@ -20,17 +22,7 @@ from saleor.payment.gateways.braintree import (
refund,
void,
)
-from saleor.payment.gateways.braintree.errors import (
- DEFAULT_ERROR_MESSAGE,
- BraintreeException,
-)
-from saleor.payment.interface import (
- CreditCardInfo,
- CustomerSource,
- GatewayConfig,
- TokenConfig,
-)
-from saleor.payment.utils import create_payment_information
+from ..errors import DEFAULT_ERROR_MESSAGE, BraintreeException
DEFAULT_ERROR = "Unable to process transaction. Please try again in a moment"
diff --git a/saleor/payment/gateways/dummy/tests/test_dummy.py b/saleor/payment/gateways/dummy/tests/test_dummy.py
index 138e4fd4a9..dab6f8f503 100644
--- a/saleor/payment/gateways/dummy/tests/test_dummy.py
+++ b/saleor/payment/gateways/dummy/tests/test_dummy.py
@@ -2,7 +2,7 @@ from decimal import Decimal
import pytest
-from saleor.payment import ChargeStatus, PaymentError, TransactionKind, gateway
+from .... import ChargeStatus, PaymentError, TransactionKind, gateway
@pytest.fixture(autouse=True)
diff --git a/saleor/payment/gateways/razorpay/tests/test_razorpay.py b/saleor/payment/gateways/razorpay/tests/test_razorpay.py
index 1a15dc4f0b..733f605bc7 100644
--- a/saleor/payment/gateways/razorpay/tests/test_razorpay.py
+++ b/saleor/payment/gateways/razorpay/tests/test_razorpay.py
@@ -4,8 +4,10 @@ from unittest.mock import patch
import pytest
from razorpay.errors import BadRequestError, ServerError
-from saleor.payment import ChargeStatus, TransactionKind
-from saleor.payment.gateways.razorpay import (
+from .... import ChargeStatus, TransactionKind
+from ....interface import GatewayConfig
+from ....utils import create_payment_information
+from .. import (
capture,
check_payment_supported,
clean_razorpay_response,
@@ -16,8 +18,6 @@ from saleor.payment.gateways.razorpay import (
logger,
refund,
)
-from saleor.payment.interface import GatewayConfig
-from saleor.payment.utils import create_payment_information
TRANSACTION_AMOUNT = Decimal("61.33")
diff --git a/saleor/payment/gateways/stripe/tests/test_stripe.py b/saleor/payment/gateways/stripe/tests/test_stripe.py
index 1d44d577c3..39f1043539 100644
--- a/saleor/payment/gateways/stripe/tests/test_stripe.py
+++ b/saleor/payment/gateways/stripe/tests/test_stripe.py
@@ -4,8 +4,10 @@ from math import isclose
import pytest
-from saleor.payment import ChargeStatus
-from saleor.payment.gateways.stripe import (
+from .... import ChargeStatus
+from ....interface import CreditCardInfo, CustomerSource, GatewayConfig
+from ....utils import create_payment_information
+from .. import (
TransactionKind,
_get_client,
authorize,
@@ -16,8 +18,6 @@ from saleor.payment.gateways.stripe import (
refund,
void,
)
-from saleor.payment.interface import CreditCardInfo, CustomerSource, GatewayConfig
-from saleor.payment.utils import create_payment_information
TRANSACTION_AMOUNT = Decimal(42.42)
TRANSACTION_REFUND_AMOUNT = Decimal(24.24)
diff --git a/saleor/payment/gateways/stripe/tests/test_utils.py b/saleor/payment/gateways/stripe/tests/test_utils.py
index 53af6d7132..56e3106e67 100644
--- a/saleor/payment/gateways/stripe/tests/test_utils.py
+++ b/saleor/payment/gateways/stripe/tests/test_utils.py
@@ -3,7 +3,9 @@ from math import isclose
from django_countries import countries
-from saleor.payment.gateways.stripe.utils import (
+from ....interface import AddressData
+from ....utils import create_payment_information
+from ..utils import (
get_amount_for_stripe,
get_amount_from_stripe,
get_currency_for_stripe,
@@ -11,8 +13,6 @@ from saleor.payment.gateways.stripe.utils import (
get_payment_billing_fullname,
shipping_to_stripe_dict,
)
-from saleor.payment.interface import AddressData
-from saleor.payment.utils import create_payment_information
def test_get_amount_for_stripe():
diff --git a/saleor/payment/tests/test_gateway.py b/saleor/payment/tests/test_gateway.py
index a9c30d861b..c7a587a7b0 100644
--- a/saleor/payment/tests/test_gateway.py
+++ b/saleor/payment/tests/test_gateway.py
@@ -3,9 +3,10 @@ from decimal import Decimal
import pytest
import saleor.payment.gateway as gateway
-from saleor.payment import ChargeStatus, TransactionKind
-from saleor.payment.interface import GatewayResponse
-from saleor.payment.utils import create_payment_information
+
+from .. import ChargeStatus, TransactionKind
+from ..interface import GatewayResponse
+from ..utils import create_payment_information
RAW_RESPONSE = {"test": "abcdefgheijklmn"}
PROCESS_PAYMENT_RESPONSE = GatewayResponse(