Skip to content

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

Add test for order history view

fowczrek6dd32078aa46
diff --git a/tests/api/benchmark/test_order.py b/tests/api/benchmark/test_order.py
new file mode 100644
index 0000000000..afa87ca59c
--- /dev/null
+++ b/tests/api/benchmark/test_order.py
@@ -0,0 +1,118 @@
+import pytest
+
+from tests.api.utils import get_graphql_content
+
+
[email protected]_queries(autouse=False)
+def test_user_order_details(user_api_client, order_with_lines, count_queries):
+ query = """
+ fragment OrderPrice on TaxedMoney {
+ gross {
+ amount
+ currency
+ }
+ net {
+ amount
+ currency
+ }
+ }
+
+ fragment Address on Address {
+ id
+ firstName
+ lastName
+ companyName
+ streetAddress1
+ streetAddress2
+ city
+ postalCode
+ country {
+ code
+ country
+ }
+ countryArea
+ phone
+ isDefaultBillingAddress
+ isDefaultShippingAddress
+ }
+
+ fragment Price on TaxedMoney {
+ gross {
+ amount
+ currency
+ }
+ net {
+ amount
+ currency
+ }
+ }
+
+ fragment ProductVariant on ProductVariant {
+ id
+ name
+ pricing {
+ onSale
+ priceUndiscounted {
+ ...Price
+ }
+ price {
+ ...Price
+ }
+ }
+ product {
+ id
+ name
+ thumbnail {
+ url
+ alt
+ }
+ thumbnail2x: thumbnail(size: 510) {
+ url
+ }
+ }
+ }
+
+ fragment OrderDetail on Order {
+ userEmail
+ paymentStatus
+ paymentStatusDisplay
+ status
+ statusDisplay
+ id
+ number
+ shippingAddress {
+ ...Address
+ }
+ lines {
+ productName
+ quantity
+ variant {
+ ...ProductVariant
+ }
+ unitPrice {
+ currency
+ ...OrderPrice
+ }
+ }
+ subtotal {
+ ...OrderPrice
+ }
+ total {
+ ...OrderPrice
+ }
+ shippingPrice {
+ ...OrderPrice
+ }
+ }
+
+ query OrderByToken($token: UUID!) {
+ orderByToken(token: $token) {
+ ...OrderDetail
+ }
+ }
+ """
+ variables = {
+ "token": order_with_lines.token,
+ }
+ get_graphql_content(user_api_client.post_graphql(query, variables))