Skip to content

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

Fix imports and formatting

Cezary Miącz8633ea9fccc6
diff --git a/saleor/plugins/webhook/tests/test_list_stored_payment_methods_webhook.py b/saleor/plugins/webhook/tests/test_list_stored_payment_methods_webhook.py
index 2a1ac32a41..5e48eea9e5 100644
--- a/saleor/plugins/webhook/tests/test_list_stored_payment_methods_webhook.py
+++ b/saleor/plugins/webhook/tests/test_list_stored_payment_methods_webhook.py
@@ -3,7 +3,6 @@ from unittest import mock
import graphene
-from ....core.models import EventDelivery
from ....payment.interface import ListStoredPaymentMethodsRequestData
from ....settings import WEBHOOK_SYNC_TIMEOUT
from ....webhook.const import WEBHOOK_CACHE_DEFAULT_TIMEOUT
diff --git a/saleor/plugins/webhook/tests/test_payment_gateway_initialize_tokenization.py b/saleor/plugins/webhook/tests/test_payment_gateway_initialize_tokenization.py
index a2b61b6217..0e92c7a540 100644
--- a/saleor/plugins/webhook/tests/test_payment_gateway_initialize_tokenization.py
+++ b/saleor/plugins/webhook/tests/test_payment_gateway_initialize_tokenization.py
@@ -4,7 +4,6 @@ from unittest import mock
import graphene
import pytest
-from ....core.models import EventDelivery
from ....payment.interface import (
PaymentGatewayInitializeTokenizationRequestData,
PaymentGatewayInitializeTokenizationResponseData,
diff --git a/saleor/plugins/webhook/tests/test_payment_method_initialize_tokenization.py b/saleor/plugins/webhook/tests/test_payment_method_initialize_tokenization.py
index 2def3495a7..ad39f816c7 100644
--- a/saleor/plugins/webhook/tests/test_payment_method_initialize_tokenization.py
+++ b/saleor/plugins/webhook/tests/test_payment_method_initialize_tokenization.py
@@ -4,7 +4,6 @@ from unittest import mock
import graphene
import pytest
-from ....core.models import EventDelivery
from ....payment import TokenizedPaymentFlow
from ....payment.interface import (
ListStoredPaymentMethodsRequestData,
@@ -509,7 +508,10 @@ def test_expected_result_invalidates_cache_for_app(
# TODO (PE-371): Assert EventDelivery DB object wasn't created
delivery = mocked_request.mock_calls[-1].args[0]
- assert delivery.event_type==WebhookEventSyncType.PAYMENT_METHOD_INITIALIZE_TOKENIZATION_SESSION
+ assert (
+ delivery.event_type
+ == WebhookEventSyncType.PAYMENT_METHOD_INITIALIZE_TOKENIZATION_SESSION
+ )
assert json.loads(delivery.payload.get_payload()) == {
"user": {"id": graphene.Node.to_global_id("User", customer_user.pk)},
"data": expected_data,
diff --git a/saleor/plugins/webhook/tests/test_payment_method_process_tokenization.py b/saleor/plugins/webhook/tests/test_payment_method_process_tokenization.py
index 35ac39f6ff..21d94f0eff 100644
--- a/saleor/plugins/webhook/tests/test_payment_method_process_tokenization.py
+++ b/saleor/plugins/webhook/tests/test_payment_method_process_tokenization.py
@@ -4,7 +4,6 @@ from unittest import mock
import graphene
import pytest
-from ....core.models import EventDelivery
from ....payment.interface import (
ListStoredPaymentMethodsRequestData,
PaymentMethodProcessTokenizationRequestData,
diff --git a/saleor/plugins/webhook/tests/test_shipping_webhook.py b/saleor/plugins/webhook/tests/test_shipping_webhook.py
index ae3a7252df..0b83c96aba 100644
--- a/saleor/plugins/webhook/tests/test_shipping_webhook.py
+++ b/saleor/plugins/webhook/tests/test_shipping_webhook.py
@@ -5,7 +5,6 @@ from unittest.mock import call
import graphene
import pytest
-from ....core.models import EventDelivery
from ....graphql.tests.utils import get_graphql_content
from ....order import OrderStatus
from ....webhook.const import CACHE_EXCLUDED_SHIPPING_TIME
diff --git a/saleor/plugins/webhook/tests/test_stored_payment_method_request_delete.py b/saleor/plugins/webhook/tests/test_stored_payment_method_request_delete.py
index 3811f3ab89..7a02cc1ff4 100644
--- a/saleor/plugins/webhook/tests/test_stored_payment_method_request_delete.py
+++ b/saleor/plugins/webhook/tests/test_stored_payment_method_request_delete.py
@@ -4,7 +4,6 @@ from unittest import mock
import graphene
import pytest
-from ....core.models import EventDelivery
from ....payment.interface import (
ListStoredPaymentMethodsRequestData,
StoredPaymentMethodRequestDeleteData,
@@ -450,7 +449,10 @@ def test_stored_payment_method_request_delete_invalidates_cache_for_app(
# TODO (PE-371): Assert EventDelivery DB object wasn't created
delivery = mocked_request.mock_calls[-1].args[0]
- assert delivery.event_type==WebhookEventSyncType.STORED_PAYMENT_METHOD_DELETE_REQUESTED
+ assert (
+ delivery.event_type
+ == WebhookEventSyncType.STORED_PAYMENT_METHOD_DELETE_REQUESTED
+ )
assert delivery.payload.get_payload() == json.dumps(
{
"user": {"id": graphene.Node.to_global_id("User", customer_user.pk)},
diff --git a/saleor/plugins/webhook/tests/test_tax_webhook.py b/saleor/plugins/webhook/tests/test_tax_webhook.py
index 4a1161c7ff..69ebbab5b1 100644
--- a/saleor/plugins/webhook/tests/test_tax_webhook.py
+++ b/saleor/plugins/webhook/tests/test_tax_webhook.py
@@ -7,7 +7,6 @@ from freezegun import freeze_time
from ....checkout.fetch import fetch_checkout_info, fetch_checkout_lines
from ....core import EventDeliveryStatus
-from ....core.models import EventDelivery, EventPayload
from ....core.taxes import TaxType
from ....graphql.webhook.utils import get_subscription_query_hash
from ....webhook.event_types import WebhookEventSyncType
@@ -68,9 +67,11 @@ def test_get_taxes_for_order(
# then
mock_request.assert_called_once()
# TODO (PE-371): Assert EventDelivery DB object wasn't created
-
+
delivery = mock_request.mock_calls[0].args[0]
- assert delivery.payload.get_payload() == generate_order_payload_for_tax_calculation(order)
+ assert delivery.payload.get_payload() == generate_order_payload_for_tax_calculation(
+ order
+ )
assert delivery.status == EventDeliveryStatus.PENDING
assert delivery.event_type == WebhookEventSyncType.ORDER_CALCULATE_TAXES
assert delivery.webhook == webhook
@@ -186,7 +187,9 @@ def test_get_taxes_for_order_with_sync_subscription(
# TODO (PE-371): Assert EventDelivery DB object wasn't created
delivery = mock_request.mock_calls[0].args[0]
- assert delivery.payload.get_payload() == json.dumps({"taxBase": {"currency": "USD"}})
+ assert delivery.payload.get_payload() == json.dumps(
+ {"taxBase": {"currency": "USD"}}
+ )
assert delivery.status == EventDeliveryStatus.PENDING
assert delivery.event_type == WebhookEventSyncType.ORDER_CALCULATE_TAXES
assert delivery.webhook == webhook
diff --git a/saleor/plugins/webhook/tests/test_transaction_initialize_session_webhook.py b/saleor/plugins/webhook/tests/test_transaction_initialize_session_webhook.py
index 9b1264587e..9f53643696 100644
--- a/saleor/plugins/webhook/tests/test_transaction_initialize_session_webhook.py
+++ b/saleor/plugins/webhook/tests/test_transaction_initialize_session_webhook.py
@@ -122,7 +122,7 @@ def _assert_fields(payload, webhook, expected_response, response, mock_request):
webhook_app = webhook.app
mock_request.assert_called_once()
# TODO (PE-371): Assert EventDelivery DB object wasn't created
-
+
delivery = mock_request.mock_calls[0].args[0]
assert json.loads(delivery.payload.get_payload()) == payload
diff --git a/saleor/webhook/tests/subscription_webhooks/test_webhook.py b/saleor/webhook/tests/subscription_webhooks/test_webhook.py
index 56a57fd6ad..c0516836e4 100644
--- a/saleor/webhook/tests/subscription_webhooks/test_webhook.py
+++ b/saleor/webhook/tests/subscription_webhooks/test_webhook.py
@@ -82,4 +82,3 @@ def test_trigger_webhook_sync_with_subscription(
delivery = mock_request.mock_calls[0].args[0]
assert json.loads(delivery.payload.get_payload()) == expected_payment_payload
-
diff --git a/saleor/webhook/tests/test_tax_webhook_tasks.py b/saleor/webhook/tests/test_tax_webhook_tasks.py
index 571b7133e7..2bf40f865a 100644
--- a/saleor/webhook/tests/test_tax_webhook_tasks.py
+++ b/saleor/webhook/tests/test_tax_webhook_tasks.py
@@ -3,7 +3,6 @@ from unittest import mock
import pytest
from ...core import EventDeliveryStatus
-from ...core.models import EventDelivery, EventPayload
from ..event_types import WebhookEventSyncType
from ..models import Webhook, WebhookEvent
from ..transport.synchronous import trigger_all_webhooks_sync
@@ -112,9 +111,7 @@ def test_trigger_tax_webhook_sync_multiple_webhooks_last(
assert mock_request.call_count == 3
# TODO (PE-371): Assert EventDelivery DB object wasn't created
- for call, webhook in zip(
- mock_request.mock_calls, tax_checkout_webhooks
- ):
+ for call, webhook in zip(mock_request.mock_calls, tax_checkout_webhooks):
delivery = call.args[0]
assert delivery.status == EventDeliveryStatus.PENDING
assert delivery.event_type == event_type