Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Extend checkout complete benchmark tests
IKarbowiakf9618e8fc77d
diff --git a/saleor/graphql/checkout/tests/benchmark/test_checkout_mutations.py b/saleor/graphql/checkout/tests/benchmark/test_checkout_mutations.pyindex de26fe7b1c..704c790cd2 100644--- a/saleor/graphql/checkout/tests/benchmark/test_checkout_mutations.py+++ b/saleor/graphql/checkout/tests/benchmark/test_checkout_mutations.py@@ -513,30 +513,129 @@ def test_checkout_payment_charge(assert not response["data"]["checkoutPaymentCreate"]["errors"]+ORDER_PRICE_FRAGMENT = """+fragment OrderPrice on TaxedMoney {+ gross {+ amount+ currency+ __typename+ }+ net {+ amount+ currency+ __typename+ }+ __typename+}+"""+++FRAGMENT_ORDER_DETAIL = (+ FRAGMENT_ADDRESS+ + FRAGMENT_PRODUCT_VARIANT+ + ORDER_PRICE_FRAGMENT+ + """+ fragment OrderDetail on Order {+ userEmail+ paymentStatus+ paymentStatusDisplay+ status+ statusDisplay+ id+ token+ number+ shippingAddress {+ ...Address+ __typename+ }+ lines {+ productName+ quantity+ variant {+ ...ProductVariant+ __typename+ }+ unitPrice {+ currency+ ...OrderPrice+ __typename+ }+ totalPrice {+ currency+ ...OrderPrice+ __typename+ }+ __typename+ }+ subtotal {+ ...OrderPrice+ __typename+ }+ total {+ ...OrderPrice+ __typename+ }+ shippingPrice {+ ...OrderPrice+ __typename+ }+ __typename+ }+ """+)+++COMPLETE_CHECKOUT_MUTATION = (+ FRAGMENT_ORDER_DETAIL+ + """+ mutation completeCheckout($checkoutId: ID!) {+ checkoutComplete(checkoutId: $checkoutId) {+ checkoutErrors {+ code+ field+ message+ }+ order {+ ...OrderDetail+ __typename+ }+ confirmationNeeded+ confirmationData+ }+ }+"""+)++@pytest.mark.django_db@pytest.mark.count_queries(autouse=False)def test_complete_checkout(api_client, checkout_with_charged_payment, count_queries):- query = """- mutation completeCheckout($checkoutId: ID!) {- checkoutComplete(checkoutId: $checkoutId) {- errors {- field- message- }- order {- id- token- }- }- }- """+ query = COMPLETE_CHECKOUT_MUTATION++ variables = {+ "checkoutId": Node.to_global_id("Checkout", checkout_with_charged_payment.pk),+ }++ response = get_graphql_content(api_client.post_graphql(query, variables))+ assert not response["data"]["checkoutComplete"]["checkoutErrors"]++[email protected]_queries(autouse=False)+def test_complete_checkout_with_single_line(+ api_client, checkout_with_charged_payment, count_queries+):+ query = COMPLETE_CHECKOUT_MUTATION+ checkout_with_charged_payment.lines.set(+ [checkout_with_charged_payment.lines.first()]+ )variables = {"checkoutId": Node.to_global_id("Checkout", checkout_with_charged_payment.pk),}response = get_graphql_content(api_client.post_graphql(query, variables))- assert not response["data"]["checkoutComplete"]["errors"]+ assert not response["data"]["checkoutComplete"]["checkoutErrors"]@pytest.mark.django_db@@ -544,20 +643,7 @@ def test_complete_checkout(api_client, checkout_with_charged_payment, count_querdef test_customer_complete_checkout(api_client, checkout_with_charged_payment, count_queries, customer_user):- query = """- mutation completeCheckout($checkoutId: ID!) {- checkoutComplete(checkoutId: $checkoutId) {- errors {- field- message- }- order {- id- token- }- }- }- """+ query = COMPLETE_CHECKOUT_MUTATIONcheckout = checkout_with_charged_paymentcheckout.user = customer_usercheckout.save()@@ -566,4 +652,4 @@ def test_customer_complete_checkout(}response = get_graphql_content(api_client.post_graphql(query, variables))- assert not response["data"]["checkoutComplete"]["errors"]+ assert not response["data"]["checkoutComplete"]["checkoutErrors"]