Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Update order benchmarks - fix test for draft orders
IKarbowiak0c546a5fce60
diff --git a/saleor/graphql/order/tests/benchmark/fixtures.py b/saleor/graphql/order/tests/benchmark/fixtures.pyindex 71176fd0fc..728acd75a2 100644--- a/saleor/graphql/order/tests/benchmark/fixtures.py+++ b/saleor/graphql/order/tests/benchmark/fixtures.py@@ -132,3 +132,5 @@ def draft_orders_for_benchmarks(orders_for_benchmarks):order.status = OrderStatus.DRAFTOrder.objects.bulk_update(orders_for_benchmarks, ["status"])++ return orders_for_benchmarksdiff --git a/saleor/graphql/order/tests/benchmark/test_order.py b/saleor/graphql/order/tests/benchmark/test_order.pyindex 070c08c31b..e8f3b8d313 100644--- a/saleor/graphql/order/tests/benchmark/test_order.py+++ b/saleor/graphql/order/tests/benchmark/test_order.py@@ -51,9 +51,16 @@ FRAGMENT_ORDER_DETAILS = (shippingAddress {...Address}+ billingAddress {+ ...Address+ }discounts {...OrderDiscounts}+ actions+ fulfillments {+ id+ }lines {productNamequantity@@ -64,6 +71,9 @@ FRAGMENT_ORDER_DETAILS = (currency...Price}+ thumbnail {+ url+ }}availableShippingMethods {...AvailableShippingMethods@@ -74,6 +84,12 @@ FRAGMENT_ORDER_DETAILS = (total {...Price}+ totalCaptured {+ amount+ }+ totalAuthorized {+ amount+ }shippingPrice {...Price}@@ -173,55 +189,20 @@ def test_staff_order_details(get_graphql_content(staff_api_client.post_graphql(query, variables))-MULTIPLE_ORDER_DETAILS_QUERY = """- query orders {- orders(first: 10) {- edges {- node {- id- shippingAddress {- id- }- billingAddress {- id- }- user {- id- }- userEmail- paymentStatus- paymentStatusDisplay- canFinalize- isShippingRequired- events {- id- }- totalCaptured {- amount- }- totalAuthorized {- amount- }- actions- subtotal {- net {- amount- }- }- fulfillments {- id- }- lines {- id- thumbnail {- url- }+MULTIPLE_ORDER_DETAILS_QUERY = (+ FRAGMENT_STAFF_ORDER_DETAILS+ + """+ query orders {+ orders(first: 10) {+ edges {+ node {+ ...OrderStaffDetail}}}}- }-"""+ """+)@pytest.mark.django_db@@ -242,6 +223,22 @@ def test_staff_multiple_orders(assert content["data"]["orders"] is not None+MULTIPLE_DRAFT_ORDER_DETAILS_QUERY = (+ FRAGMENT_STAFF_ORDER_DETAILS+ + """+ query draftOrders {+ draftOrders(first: 10) {+ edges {+ node {+ ...OrderStaffDetail+ }+ }+ }+ }+ """+)++@pytest.mark.django_db@pytest.mark.count_queries(autouse=False)def test_staff_multiple_draft_orders(@@ -255,6 +252,6 @@ def test_staff_multiple_draft_orders([permission_manage_orders, permission_manage_users])content = get_graphql_content(- staff_api_client.post_graphql(MULTIPLE_ORDER_DETAILS_QUERY)+ staff_api_client.post_graphql(MULTIPLE_DRAFT_ORDER_DETAILS_QUERY))- assert content["data"]["orders"] is not None+ assert content["data"]["draftOrders"] is not None