Skip to content

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

Refactor test_payment_webhook

Cezary Miącz7c1950c7ad5d
diff --git a/saleor/plugins/webhook/tests/test_payment_webhook.py b/saleor/plugins/webhook/tests/test_payment_webhook.py
index f6520eb3b2..f4b7d9a4d2 100644
--- a/saleor/plugins/webhook/tests/test_payment_webhook.py
+++ b/saleor/plugins/webhook/tests/test_payment_webhook.py
@@ -72,8 +72,8 @@ def test_trigger_webhook_sync(mock_request, payment_app):
trigger_webhook_sync(
WebhookEventSyncType.PAYMENT_CAPTURE, data, payment_app.webhooks.first(), False
)
- event_delivery = EventDelivery.objects.first()
- mock_request.assert_called_once_with(event_delivery)
+ mock_request.assert_called_once()
+ # TODO (PE-371): Assert EventDelivery DB object wasn't created
@mock.patch(
@@ -155,10 +155,12 @@ def test_send_webhook_request_sync_successful_attempt(
# when
response_data = send_webhook_request_sync(event_delivery)
- attempt = EventDeliveryAttempt.objects.first()
-
# then
mock_clear_delivery.assert_called_once_with(event_delivery)
+ mock_observability.assert_called_once()
+ # TODO (PE-371): Assert EventDeliveryAttempt DB object wasn't created
+
+ attempt = mock_observability.mock_calls[0].args[0]
assert event_delivery.status == EventDeliveryStatus.SUCCESS
assert attempt.status == EventDeliveryStatus.SUCCESS
assert attempt.duration == expected_data["duration"].total_seconds()