Skip to content

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

Benchmarks for totalCaptured, totalAuthorized, events and subtotal on Order type

Tomasz Szymanski67355aef9b4b
diff --git a/saleor/graphql/order/tests/benchmark/fixtures.py b/saleor/graphql/order/tests/benchmark/fixtures.py
index 14d6dd10dd..15b46bb687 100644
--- a/saleor/graphql/order/tests/benchmark/fixtures.py
+++ b/saleor/graphql/order/tests/benchmark/fixtures.py
@@ -1,5 +1,6 @@
import random
import uuid
+from decimal import Decimal
import pytest
from prices import Money, TaxedMoney
@@ -12,7 +13,6 @@ from .....payment.models import Payment
ORDER_COUNT_IN_BENCHMARKS = 10
EVENTS_PER_ORDER = 5
-PAYMENTS_PER_ORDER = 3
def _prepare_payments_for_order(order):
@@ -21,9 +21,22 @@ def _prepare_payments_for_order(order):
gateway="mirumee.payments.dummy",
order=order,
is_active=True,
- charge_status=random.choice(ChargeStatus.CHOICES)[0],
- )
- for _ in range(PAYMENTS_PER_ORDER)
+ charge_status=ChargeStatus.NOT_CHARGED,
+ ),
+ Payment(
+ gateway="mirumee.payments.dummy",
+ order=order,
+ is_active=True,
+ charge_status=ChargeStatus.PARTIALLY_CHARGED,
+ captured_amount=Decimal("6.0"),
+ ),
+ Payment(
+ gateway="mirumee.payments.dummy",
+ order=order,
+ is_active=True,
+ charge_status=ChargeStatus.FULLY_CHARGED,
+ captured_amount=Decimal("10.0"),
+ ),
]
diff --git a/saleor/graphql/order/tests/benchmark/test_order.py b/saleor/graphql/order/tests/benchmark/test_order.py
index ce4e436665..f8e3953b8d 100644
--- a/saleor/graphql/order/tests/benchmark/test_order.py
+++ b/saleor/graphql/order/tests/benchmark/test_order.py
@@ -174,6 +174,21 @@ MULTIPLE_ORDER_ADDRESS_DETAILS_QUERY = """
events {
id
}
+ totalCaptured {
+ amount
+ }
+ totalAuthorized {
+ amount
+ }
+ actions
+ subtotal {
+ net {
+ amount
+ }
+ }
+ fulfillments {
+ id
+ }
}
}
}