repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
saleor
saleor/tests/e2e/checkout/zero_total/test_pay_for_total_checkout_with_gift_card.py
.py
import pytest from ...channel.utils import update_channel from ...gift_cards.utils import create_gift_card from ...orders.utils.order_query import order_query from ...product.utils.preparing_product import prepare_products from ...shop.utils.preparing_shop import prepare_default_shop from ...utils import assign_permis...
155
5,190
saleor
saleor/tests/e2e/checkout/zero_total/test_0_total_checkout_catalog_promotion_and_shipping_voucher.py
.py
import pytest from .....product.tasks import recalculate_discounted_price_for_products_task from ...channel.utils import update_channel from ...product.utils.preparing_product import prepare_products from ...promotions.utils import create_promotion, create_promotion_rule from ...shop.utils.preparing_shop import prepar...
209
7,589
saleor
saleor/tests/e2e/checkout/zero_total/test_0_total_checkout_line_voucher_and_click_and_collect.py
.py
import pytest from ...channel.utils import update_channel from ...product.utils.preparing_product import prepare_products from ...shop.utils.preparing_shop import prepare_default_shop from ...utils import assign_permissions from ...vouchers.utils.prepare_voucher import prepare_voucher from ...warehouse.utils import up...
217
8,453
saleor
saleor/tests/e2e/checkout/zero_total/test_0_total_checkout_with_order_promotion_and_free_shipping.py
.py
import pytest from ...product.utils.preparing_product import prepare_products from ...promotions.utils import create_promotion from ...shop.utils.preparing_shop import prepare_shop from ...utils import assign_permissions from ..utils import ( checkout_complete, checkout_create, checkout_delivery_method_upd...
258
9,662
saleor
saleor/tests/e2e/checkout/shipping/test_checkout_invalidate_price_based_shipping_on_voucher_add.py
.py
import pytest from ...product.utils.preparing_product import prepare_product from ...shop.utils.preparing_shop import prepare_shop from ...utils import assign_permissions from ...vouchers.utils import create_voucher, create_voucher_channel_listing from ..utils import ( checkout_complete, checkout_create, c...
196
6,234
saleor
saleor/tests/e2e/checkout/shipping/test_use_external_shipping_methods_in_checkout.py
.py
import pytest import vcr from ...apps.utils import add_app from ...product.utils.preparing_product import prepare_product from ...shop.utils.preparing_shop import prepare_default_shop from ...utils import assign_permissions, request_matcher from ...webhooks.utils import create_webhook from ..utils import ( checkou...
144
5,213
saleor
saleor/tests/e2e/checkout/taxes/test_checkout_calculate_simple_taxes_for_products_without_shipping.py
.py
import pytest from ...product.utils.preparing_product import prepare_product from ...shop.utils.preparing_shop import prepare_shop from ...taxes.utils import update_country_tax_rates from ...utils import assign_permissions from ..utils import ( checkout_billing_address_update, checkout_complete, checkout_c...
159
4,855
saleor
saleor/tests/e2e/checkout/taxes/test_checkout_with_click_and_collect_calculate_simple_taxes_based_on_shipping_address.py
.py
import pytest from ... import ADDRESS_DE from ...product.utils.preparing_product import prepare_product from ...shop.utils import prepare_shop from ...taxes.utils import update_country_tax_rates from ...utils import assign_permissions from ...warehouse.utils import update_warehouse from ..utils import ( checkout_b...
329
10,181
saleor
saleor/tests/e2e/checkout/taxes/test_checkout_calculate_simple_taxes_product_type_tax_class.py
.py
import pytest from ...product.utils import ( create_category, create_product, create_product_channel_listing, create_product_type, create_product_variant, create_product_variant_channel_listing, update_product_type, ) from ...shop.utils.preparing_shop import prepare_shop from ...taxes.utils...
214
6,495
saleor
saleor/tests/e2e/checkout/taxes/test_checkout_calculate_simple_taxes_product_tax_class.py
.py
import pytest from ...product.utils import update_product from ...product.utils.preparing_product import prepare_product from ...shop.utils.preparing_shop import prepare_shop from ...taxes.utils import update_country_tax_rates from ...utils import assign_permissions from ..utils import ( checkout_complete, che...
160
5,178
saleor
saleor/tests/e2e/checkout/taxes/test_checkout_complete_return_tax_error.py
.py
import pytest from ...apps.utils import add_app from ...product.utils.preparing_product import prepare_product from ...shop.utils import prepare_default_shop from ...taxes.utils import get_tax_configurations, update_tax_configuration from ...utils import assign_permissions from ...webhooks.utils import create_webhook ...
138
5,480
saleor
saleor/tests/e2e/checkout/taxes/test_checkout_calculate_simple_taxes_based_on_shipping_country.py
.py
import pytest from ... import ADDRESS_DE from ...product.utils.preparing_product import prepare_product from ...shop.utils import prepare_shop from ...taxes.utils import update_country_tax_rates from ...utils import assign_permissions from ..utils import ( checkout_billing_address_update, checkout_complete, ...
217
6,722
saleor
saleor/tests/e2e/checkout/taxes/test_order_create_from_checkout_return_tax_error.py
.py
import pytest from ...apps.utils import add_app from ...orders.utils import raw_order_create_from_checkout from ...product.utils.preparing_product import prepare_product from ...shop.utils import prepare_default_shop from ...taxes.utils import get_tax_configurations, update_tax_configuration from ...utils import assig...
135
5,526
saleor
saleor/tests/e2e/checkout/taxes/test_checkout_calculate_simple_taxes_based_on_shipping_tax_class.py
.py
import pytest from ...product.utils.preparing_product import prepare_product from ...shipping_zone.utils import update_shipping_price from ...shop.utils import prepare_shop from ...taxes.utils import update_country_tax_rates from ...utils import assign_permissions from ..utils import ( checkout_complete, check...
174
5,873
saleor
saleor/tests/e2e/checkout/utils/checkout_lines_update.py
.py
from ...utils import get_graphql_content CHECKOUT_LINES_UPDATE_MUTATION = """ mutation checkoutLinesUpdate($checkoutId: ID!, $lines: [CheckoutLineUpdateInput!]!) { checkoutLinesUpdate(lines: $lines, checkoutId: $checkoutId) { checkout { discountName discount { amount } subtotalPri...
76
1,354
saleor
saleor/tests/e2e/checkout/utils/checkout_create.py
.py
from ... import DEFAULT_ADDRESS from ...account.utils.fragments import ADDRESS_FRAGMENT from ...utils import get_graphql_content CHECKOUT_CREATE_MUTATION = ( """ mutation CreateCheckout($input: CheckoutCreateInput!) { checkoutCreate(input: $input) { errors { field code message } che...
190
3,574
saleor
saleor/tests/e2e/checkout/utils/checkout_add_promo_code.py
.py
from ...utils import get_graphql_content CHECKOUT_ADD_PROMO_CODE_MUTATION = """ mutation AddCheckoutPromoCode($checkoutId: ID!, $promoCode: String!) { checkoutAddPromoCode(id: $checkoutId, promoCode: $promoCode) { checkout { id totalPrice { gross { amount } } sub...
107
1,859
saleor
saleor/tests/e2e/checkout/utils/__init__.py
.py
from ...orders.utils.draft_order_create import draft_order_create from ...orders.utils.order_lines_create import order_lines_create from ...product.utils.product_channel_listing import raw_create_product_channel_listing from .checkout_add_promo_code import ( checkout_add_promo_code, raw_checkout_add_promo_code,...
52
1,977
saleor
saleor/tests/e2e/checkout/utils/checkout_shipping_address_update.py
.py
from ... import DEFAULT_ADDRESS from ...utils import assert_address_data, get_graphql_content CHECKOUT_SHIPPING_ADDRESS_UPDATE_MUTATION = """ mutation CheckoutShippingAddressUpdate( $shippingAddress: AddressInput!, $checkoutId: ID! ) { checkoutShippingAddressUpdate( shippingAddress: $shippingAddress id: $c...
72
1,611
saleor
saleor/tests/e2e/checkout/utils/checkout_create_from_order.py
.py
from saleor.graphql.tests.utils import get_graphql_content CHECKOUT_CREATE_FROM_ORDER_MUTATION = """ mutation CheckoutCreateFromOrder( $id: ID!){ checkoutCreateFromOrder(id: $id){ errors{ field message code } unavailableVariants{ lineId variantId code message ...
126
2,119
saleor
saleor/tests/e2e/checkout/utils/checkout_lines_delete.py
.py
from ...utils import get_graphql_content CHECKOUT_LINES_DELETE_MUTATION = """ mutation CheckoutLinesDelete($checkoutId: ID!, $linesIds: [ID!]!) { checkoutLinesDelete(id: $checkoutId, linesIds: $linesIds) { checkout { discountName discount { amount } subtotalPrice { gross {...
73
1,365
saleor
saleor/tests/e2e/checkout/utils/query_checkout.py
.py
from ...utils import get_graphql_content CHECKOUT_QUERY = """ query Checkout($checkoutId: ID!){ checkout(id: $checkoutId){ id voucherCode discount { amount } totalPrice{ gross{ amount } net{ amount } tax{ amount } } sub...
72
1,016
saleor
saleor/tests/e2e/checkout/utils/checkout_remove_promo_code.py
.py
from ...utils import get_graphql_content CHECKOUT_REMOVE_PROMO_CODE_MUTATION = """ mutation CheckoutRemovePromoCode($id: ID, $promoCode: String) { checkoutRemovePromoCode( id: $id promoCode: $promoCode ) { errors { message field code } ...
44
937
saleor
saleor/tests/e2e/checkout/utils/checkout_payment_create.py
.py
from ...utils import get_graphql_content CHECKOUT_PAYMENT_CREATE_MUTATION = """ mutation createPayment($checkoutId: ID, $input: PaymentInput!) { checkoutPaymentCreate(id: $checkoutId, input: $input) { errors { field code message } checkout { id } payment { id } ...
61
1,451
saleor
saleor/tests/e2e/checkout/utils/checkout_billing_address_update.py
.py
from ... import DEFAULT_ADDRESS from ...utils import assert_address_data, get_graphql_content CHECKOUT_BILLING_ADDRESS_UPDATE_MUTATION = """ mutation CheckoutBillingAddressUpdate( $billingAddress: AddressInput!, $checkoutId: ID! ) { checkoutBillingAddressUpdate(billingAddress: $billingAddress, id: $checkoutId) { ...
51
1,198
saleor
saleor/tests/e2e/checkout/utils/checkout_complete.py
.py
from ...account.utils.fragments import ADDRESS_FRAGMENT from ...utils import get_graphql_content CHECKOUT_COMPLETE_MUTATION = ( """ mutation CheckoutComplete($checkoutId: ID!) { checkoutComplete(id: $checkoutId) { errors { message field code } order { id userEmail ...
166
2,826
saleor
saleor/tests/e2e/checkout/utils/checkout_lines_add.py
.py
from ...utils import get_graphql_content CHECKOUT_LINES_ADD_MUTATION = """ mutation checkoutLinesAdd($checkoutId: ID!, $lines: [CheckoutLineInput!]!) { checkoutLinesAdd(id: $checkoutId, lines: $lines) { checkout { lines { id isGift quantity variant { id } ...
82
1,462
saleor
saleor/tests/e2e/checkout/utils/checkout_delivery_method_update.py
.py
from ...account.utils.fragments import ADDRESS_FRAGMENT from ...utils import get_graphql_content CHECKOUT_DELIVERY_METHOD_UPDATE_MUTATION = ( """ mutation checkoutDeliveryMethodUpdate($checkoutId: ID!, $deliveryMethodId: ID) { checkoutDeliveryMethodUpdate( id: $checkoutId deliveryMethodId: $deliveryMetho...
99
1,816
saleor
saleor/tests/e2e/checkout/utils/checkout_email_update.py
.py
from ...utils import get_graphql_content CHECKOUT_EMAIL_UPDATE_MUTATION = """ mutation checkoutEmailUpdate($checkoutId: ID!, $email: String!){ checkoutEmailUpdate( id: $checkoutId email: $email ) { checkout { email } errors { field message } } } """ def checkout_update...
37
742
saleor
saleor/tests/e2e/checkout/discounts/test_checkout_with_promotion_and_voucher.py
.py
import pytest from .....product.tasks import recalculate_discounted_price_for_products_task from ...product.utils.preparing_product import prepare_product from ...promotions.utils import create_promotion, create_promotion_rule from ...shop.utils.preparing_shop import prepare_default_shop from ...utils import assign_pe...
436
13,786
saleor
saleor/tests/e2e/checkout/discounts/test_checkout_calculate_correct_discount_for_sale_and_voucher.py
.py
import pytest from .....product.tasks import recalculate_discounted_price_for_products_task from ...product.utils.preparing_product import prepare_products from ...sales.utils import create_sale, create_sale_channel_listing, sale_catalogues_add from ...shop.utils import prepare_default_shop from ...utils import assign...
1,856
74,507
saleor
saleor/tests/e2e/checkout/discounts/vouchers/test_checkout_with_free_shipping_voucher_with_min_quantity_of_items.py
.py
import pytest from ....product.utils.preparing_product import prepare_product from ....shop.utils import prepare_default_shop from ....utils import assign_permissions from ....vouchers.utils import create_voucher, create_voucher_channel_listing from ...utils import ( checkout_add_promo_code, checkout_complete,...
180
5,606
saleor
saleor/tests/e2e/checkout/discounts/vouchers/test_checkout_voucher_is_still_active_when_checkout_fails.py
.py
import pytest from ....product.utils import product_variant_stock_update from ....product.utils.preparing_product import prepare_product from ....shop.utils import prepare_default_shop from ....utils import assign_permissions from ....vouchers.utils import ( create_voucher, create_voucher_channel_listing, ...
170
5,037
saleor
saleor/tests/e2e/checkout/discounts/vouchers/test_only_one_voucher_per_checkout.py
.py
import pytest from ....product.utils.preparing_product import prepare_product from ....shop.utils import prepare_default_shop from ....utils import assign_permissions from ....vouchers.utils import ( create_voucher, create_voucher_channel_listing, get_voucher, ) from ...utils import ( checkout_add_prom...
223
6,942
saleor
saleor/tests/e2e/checkout/discounts/vouchers/test_checkout_use_voucher_for_cheapest_product.py
.py
import pytest from ....product.utils import ( create_product_variant, create_product_variant_channel_listing, ) from ....product.utils.preparing_product import prepare_product from ....shop.utils import prepare_default_shop from ....utils import assign_permissions from ....vouchers.utils import create_voucher,...
229
7,496
saleor
saleor/tests/e2e/checkout/discounts/vouchers/test_checkout_with_voucher_with_min_item_quantity.py
.py
import pytest from ....product.utils.preparing_product import prepare_product from ....shop.utils import prepare_default_shop from ....utils import assign_permissions from ....vouchers.utils import ( create_voucher, create_voucher_channel_listing, get_voucher, ) from ...utils import ( checkout_add_prom...
199
6,097
saleor
saleor/tests/e2e/checkout/discounts/vouchers/test_checkout_unable_to_use_expired_voucher.py
.py
import datetime import pytest from django.utils import timezone from ....product.utils.preparing_product import prepare_product from ....shop.utils import prepare_default_shop from ....utils import assign_permissions from ....vouchers.utils import ( create_voucher, create_voucher_channel_listing, get_vouc...
166
4,828
saleor
saleor/tests/e2e/checkout/discounts/vouchers/test_checkout_with_fixed_voucher_should_not_result_in_negative_variant_price.py
.py
import pytest from ....product.utils.preparing_product import prepare_product from ....shop.utils import prepare_default_shop from ....utils import assign_permissions from ....vouchers.utils import create_voucher, create_voucher_channel_listing from ...utils import ( checkout_add_promo_code, checkout_complete,...
167
5,146
saleor
saleor/tests/e2e/checkout/discounts/vouchers/test_checkout_with_voucher_limit_per_customer.py
.py
import pytest from ....product.utils.preparing_product import prepare_product from ....shop.utils import prepare_default_shop from ....utils import assign_permissions from ....vouchers.utils import ( create_voucher, create_voucher_channel_listing, get_voucher, ) from ...utils import ( checkout_add_prom...
201
6,312
saleor
saleor/tests/e2e/checkout/discounts/vouchers/test_checkout_user_cannot_use_voucher_for_staff_only.py
.py
import pytest from ....product.utils.preparing_product import prepare_product from ....shop.utils import prepare_default_shop from ....utils import assign_permissions from ....vouchers.utils import create_voucher, create_voucher_channel_listing from ...utils import checkout_create, raw_checkout_add_promo_code def pr...
112
3,074
saleor
saleor/tests/e2e/checkout/discounts/vouchers/test_staff_user_can_use_voucher_for_staff_only.py
.py
import pytest from ....product.utils.preparing_product import prepare_product from ....shop.utils import prepare_default_shop from ....utils import assign_permissions from ....vouchers.utils import create_voucher, create_voucher_channel_listing from ...utils import ( checkout_add_promo_code, checkout_complete,...
149
4,429
saleor
saleor/tests/e2e/checkout/discounts/vouchers/test_checkout_apply_voucher_to_the_specific_product_per_order.py
.py
import pytest from ....product.utils import ( create_category, create_product, create_product_channel_listing, create_product_type, create_product_variant, create_product_variant_channel_listing, ) from ....shop.utils import prepare_default_shop from ....utils import assign_permissions from ......
310
9,242
saleor
saleor/tests/e2e/checkout/discounts/vouchers/test_checkout_with_percentage_voucher.py
.py
import pytest from ....product.utils.preparing_product import prepare_product from ....shop.utils import prepare_default_shop from ....utils import assign_permissions from ....vouchers.utils import create_voucher, create_voucher_channel_listing from ...utils import ( checkout_add_promo_code, checkout_complete,...
153
4,531
saleor
saleor/tests/e2e/checkout/discounts/vouchers/test_checkout_voucher_is_still_active_when_payment_fails.py
.py
import pytest from ....product.utils.preparing_product import prepare_product from ....shop.utils import prepare_default_shop from ....utils import assign_permissions from ....vouchers.utils import ( create_voucher, create_voucher_channel_listing, get_voucher, ) from ...utils import ( checkout_add_prom...
161
4,778
saleor
saleor/tests/e2e/checkout/discounts/vouchers/test_should_be_able_to_remove_voucher_code_from_checkout.py
.py
import pytest from ....product.utils.preparing_product import prepare_product from ....shop.utils import prepare_default_shop from ....utils import assign_permissions from ....vouchers.utils import ( create_voucher, create_voucher_channel_listing, get_voucher, ) from ...utils import ( checkout_add_prom...
181
5,779
saleor
saleor/tests/e2e/checkout/discounts/vouchers/test_checkout_unable_to_use_not_started_voucher.py
.py
import datetime import pytest from django.utils import timezone from ....product.utils.preparing_product import prepare_product from ....shop.utils import prepare_default_shop from ....utils import assign_permissions from ....vouchers.utils import ( create_voucher, create_voucher_channel_listing, get_vouc...
165
4,828
saleor
saleor/tests/e2e/checkout/discounts/vouchers/test_checkout_unable_to_update_single_use_settings_after_usage.py
.py
import pytest from ....product.utils.preparing_product import prepare_product from ....shop.utils import prepare_default_shop from ....utils import assign_permissions from ....vouchers.utils import ( create_voucher, create_voucher_channel_listing, raw_update_voucher, ) from ...utils import ( checkout_a...
167
5,198
saleor
saleor/tests/e2e/checkout/discounts/vouchers/test_checkout_unable_to_use_deleted_voucher.py
.py
import pytest from ....product.utils.preparing_product import prepare_product from ....shop.utils import prepare_default_shop from ....utils import assign_permissions from ....vouchers.utils import ( create_voucher, create_voucher_channel_listing, get_voucher, voucher_delete, ) from ...utils import che...
127
3,545
saleor
saleor/tests/e2e/checkout/discounts/vouchers/test_checkout_with_free_shipping_voucher_with_min_spent_amount.py
.py
import pytest from ....product.utils.preparing_product import prepare_product from ....shop.utils import prepare_default_shop from ....utils import assign_permissions from ....vouchers.utils import create_voucher, create_voucher_channel_listing from ...utils import ( checkout_add_promo_code, checkout_complete,...
180
5,583
saleor
saleor/tests/e2e/checkout/discounts/vouchers/test_checkout_with_fixed_voucher.py
.py
import pytest from ....product.utils.preparing_product import prepare_product from ....shop.utils import prepare_default_shop from ....utils import assign_permissions from ....vouchers.utils import create_voucher, create_voucher_channel_listing from ...utils import ( checkout_add_promo_code, checkout_complete,...
163
5,044
saleor
saleor/tests/e2e/checkout/discounts/vouchers/test_checkout_unable_to_exceed_voucher_usage_limit.py
.py
import pytest from ....product.utils.preparing_product import prepare_product from ....shop.utils import prepare_default_shop from ....utils import assign_permissions from ....vouchers.utils import ( create_voucher, create_voucher_channel_listing, get_voucher, ) from ...utils import ( checkout_add_prom...
200
6,298
saleor
saleor/tests/e2e/checkout/discounts/vouchers/test_checkout_unable_to_use_deleted_voucher_code.py
.py
import pytest from ....product.utils.preparing_product import prepare_product from ....shop.utils import prepare_default_shop from ....utils import assign_permissions from ....vouchers.utils import ( create_voucher, create_voucher_channel_listing, get_voucher, voucher_code_bulk_delete, ) from ...utils ...
138
4,180
saleor
saleor/tests/e2e/checkout/discounts/promotions/test_promotion_discount_applied_on_checkout_with_specific_total_and_subtotal.py
.py
from decimal import Decimal import pytest from ......checkout.models import Checkout from ......discount import DiscountType, RewardValueType from ....product.utils.preparing_product import prepare_product from ....promotions.utils import create_promotion, create_promotion_rule from ....shop.utils.preparing_shop impo...
181
6,345
saleor
saleor/tests/e2e/checkout/discounts/promotions/test_checkout_products_on_percentage_promotion.py
.py
import pytest from ......product.tasks import recalculate_discounted_price_for_products_task from ....product.utils.preparing_product import prepare_product from ....promotions.utils import create_promotion, create_promotion_rule from ....shop.utils import prepare_default_shop from ....utils import assign_permissions ...
126
4,323
saleor
saleor/tests/e2e/checkout/discounts/promotions/test_promotion_applied_on_checkout_with_subtotal_within_specified_range.py
.py
from decimal import Decimal import pytest from ......checkout.models import Checkout from ......discount import DiscountType, RewardValueType from ....product.utils.preparing_product import prepare_product from ....promotions.utils import ( create_promotion, create_promotion_rule, ) from ....shop.utils.prepar...
302
10,867
saleor
saleor/tests/e2e/checkout/discounts/promotions/test_promotion_applied_on_checkout_with_specific_subtotal.py
.py
from decimal import Decimal import pytest from ......checkout.models import Checkout from ......discount import DiscountType, RewardValueType from ....product.utils.preparing_product import prepare_product from ....promotions.utils import create_promotion, create_promotion_rule from ....shop.utils.preparing_shop impo...
167
5,995
saleor
saleor/tests/e2e/checkout/discounts/promotions/test_checkout_products_on_fixed_promotion.py
.py
import pytest from ......product.tasks import recalculate_discounted_price_for_products_task from ....product.utils.preparing_product import prepare_product from ....promotions.utils import create_promotion, create_promotion_rule from ....shop.utils import prepare_default_shop from ....utils import assign_permissions ...
129
4,430
saleor
saleor/tests/e2e/checkout/discounts/promotions/test_checkout_with_fixed_promotion_should_not_result_in_negative_price.py
.py
import pytest from ......product.tasks import recalculate_discounted_price_for_products_task from ....product.utils import get_product from ....product.utils.preparing_product import prepare_product from ....promotions.utils import create_promotion, create_promotion_rule from ....shop.utils import prepare_default_shop...
110
3,763
saleor
saleor/tests/e2e/checkout/discounts/promotions/test_checkout_custom_price_and_percentage_promotion.py
.py
import pytest from ......product.tasks import recalculate_discounted_price_for_products_task from ....checkout.utils import checkout_lines_update from ....product.utils.preparing_product import prepare_product from ....promotions.utils import create_promotion, create_promotion_rule from ....shop.utils import prepare_d...
146
5,409
saleor
saleor/tests/e2e/checkout/discounts/promotions/test_checkout_custom_price_and_fixed_promotion.py
.py
import pytest from ......product.tasks import recalculate_discounted_price_for_products_task from ....checkout.utils import checkout_lines_update from ....product.utils.preparing_product import prepare_product from ....promotions.utils import create_promotion, create_promotion_rule from ....shop.utils import prepare_d...
148
5,442
saleor
saleor/tests/e2e/checkout/discounts/sales/test_checkout_custom_price_and_fixed_sale.py
.py
import pytest from ......product.tasks import recalculate_discounted_price_for_products_task from ....checkout.utils import checkout_lines_update from ....product.utils.preparing_product import prepare_product from ....sales.utils import ( create_sale, create_sale_channel_listing, sale_catalogues_add, ) fr...
150
5,147
saleor
saleor/tests/e2e/checkout/discounts/sales/test_checkout_product_on_percentage_sale.py
.py
import pytest from ......product.tasks import recalculate_discounted_price_for_products_task from ....product.utils.preparing_product import prepare_products from ....sales.utils import ( create_sale, create_sale_channel_listing, sale_catalogues_add, ) from ....shop.utils import prepare_default_shop from ....
407
15,654
saleor
saleor/tests/e2e/checkout/discounts/sales/test_checkout_product_on_fixed_sale.py
.py
import pytest from ......product.tasks import recalculate_discounted_price_for_products_task from ....product.utils.preparing_product import prepare_products from ....sales.utils import ( create_sale, create_sale_channel_listing, sale_catalogues_add, ) from ....shop.utils import prepare_default_shop from ....
402
15,217
saleor
saleor/tests/e2e/checkout/discounts/sales/test_checkout_custom_price_and_percentage_sale.py
.py
import pytest from ......product.tasks import recalculate_discounted_price_for_products_task from ....checkout.utils import checkout_lines_update from ....product.utils.preparing_product import prepare_product from ....sales.utils import ( create_sale, create_sale_channel_listing, sale_catalogues_add, ) fr...
150
5,120
saleor
saleor/tests/e2e/checkout/discounts/sales/test_checkout_with_fixed_sale_should_not_result_in_negative_price.py
.py
import pytest from ......product.tasks import recalculate_discounted_price_for_products_task from ....product.utils import get_product from ....product.utils.preparing_product import prepare_products from ....sales.utils import ( create_sale, create_sale_channel_listing, sale_catalogues_add, ) from ....sho...
336
11,843
saleor
saleor/tests/e2e/transactions/utils/transaction_event_report.py
.py
from ...utils import get_graphql_content TRANSACTION_EVENT_REPORT_MUTATION = """ mutation TransactionEventReport( $id: ID $type: TransactionEventTypeEnum! $amount: PositiveDecimal! $pspReference: String! $time: DateTime $externalUrl: String $message: String ...
104
2,594
saleor
saleor/tests/e2e/transactions/utils/__init__.py
.py
from .transaction_create import create_transaction from .transaction_event_report import transaction_event_report from .transaction_initialize import transaction_initialize __all__ = [ "create_transaction", "transaction_initialize", "transaction_event_report", ]
10
276
saleor
saleor/tests/e2e/transactions/utils/transaction_initialize.py
.py
from unittest import mock from .....giftcard.const import GIFT_CARD_PAYMENT_GATEWAY_ID from .....payment.interface import TransactionSessionResult from ...utils import get_graphql_content TRANSACTION_INITIALIZE_MUTATION = """ mutation TransactionInitialize( $action: TransactionFlowStrategyEnum, $amount: PositiveD...
140
3,165
saleor
saleor/tests/e2e/transactions/utils/transaction_create.py
.py
from ...utils import get_graphql_content TRANSACTION_CREATE_MUTATION = """ mutation TransactionCreate($id: ID!, $transactionCreateInput: TransactionCreateInput!) { transactionCreate(id: $id, transaction: $transactionCreateInput) { errors { field message code } transaction { id ...
80
2,237
saleor
saleor/tests/e2e/sales/utils/__init__.py
.py
from .sale_catalogues_add import sale_catalogues_add from .sale_channel_listing import ( create_sale_channel_listing, raw_create_sale_channel_listing, ) from .sale_create import create_sale __all__ = [ "create_sale", "create_sale_channel_listing", "sale_catalogues_add", "raw_create_sale_channel...
14
333
saleor
saleor/tests/e2e/sales/utils/sale_catalogues_add.py
.py
from ...utils import get_graphql_content SALE_CATALOGUES_ADD_MUTATION = """ mutation SaleCataloguesAdd($id: ID!, $input: CatalogueInput!, $first: Int) { saleCataloguesAdd(id: $id, input: $input) { errors { field message code } sale { id name channelListings { c...
73
1,324
saleor
saleor/tests/e2e/sales/utils/sale_channel_listing.py
.py
from ...utils import get_graphql_content SALE_CREATE_CHANNEL_LISTING_MUTATION = """ mutation SaleUpdate($id: ID!, $input: SaleChannelListingInput!) { saleChannelListingUpdate(id: $id, input: $input) { errors { field message code } sale { id name channelListings { ...
72
1,469
saleor
saleor/tests/e2e/sales/utils/sale_create.py
.py
from ...utils import get_graphql_content SALE_CREATE_MUTATION = """ mutation createSale($input: SaleInput!) { saleCreate(input: $input) { errors { field code message } sale { id name type startDate endDate } } } """ def create_sale( staff_api_cl...
45
845
saleor
saleor/tests/e2e/shop/utils/preparing_shop.py
.py
from ...channel.utils import create_channel from ...shipping_zone.utils import ( create_shipping_method, create_shipping_method_channel_listing, create_shipping_zone, ) from ...taxes.utils import ( create_tax_class, get_tax_configurations, update_tax_class, update_tax_configuration, ) from ....
173
6,001
saleor
saleor/tests/e2e/shop/utils/__init__.py
.py
from .preparing_shop import prepare_default_shop, prepare_shop from .shop_update_settings import update_shop_settings __all__ = [ "prepare_shop", "prepare_default_shop", "update_shop_settings", ]
9
209
saleor
saleor/tests/e2e/shop/utils/shop_update_settings.py
.py
from ...utils import get_graphql_content SHOP_SETTING_UPDATE_MUTATION = """ mutation ShopSettingsUpdate($input: ShopSettingsInput!) { shopSettingsUpdate(input: $input) { errors { field message code } shop { enableAccountConfirmationByEmail fulfillmentAutoApprove fulfil...
42
993
saleor
saleor/tests/e2e/warehouse/utils/create_warehouse.py
.py
import uuid from ... import DEFAULT_WAREHOUSE_ADDRESS from ...utils import get_graphql_content WAREHOUSE_CREATE_MUTATION = """ mutation createWarehouse($input: WarehouseCreateInput!) { createWarehouse(input: $input) { errors { message field code } warehouse { id name ...
63
1,255
saleor
saleor/tests/e2e/warehouse/utils/update_warehouse.py
.py
from ...utils import get_graphql_content WAREHOUSE_UPDATE_MUTATION = """ mutation updateWarehouse($id: ID! $input: WarehouseUpdateInput!) { updateWarehouse(id: $id, input: $input) { errors { message field code } warehouse { id name slug clickAndCollectOption ...
45
1,038
saleor
saleor/tests/e2e/warehouse/utils/__init__.py
.py
from .create_warehouse import create_warehouse from .update_warehouse import update_warehouse __all__ = ["create_warehouse", "update_warehouse"]
5
146
saleor
saleor/tests/e2e/channel/utils/channel_create.py
.py
import uuid from ...utils import get_graphql_content CHANNEL_CREATE_MUTATION = """ mutation ChannelCreate($input: ChannelCreateInput!) { channelCreate(input: $input) { errors { field message code } channel { id name slug currencyCode defaultCountry { ...
118
2,807
saleor
saleor/tests/e2e/channel/utils/__init__.py
.py
from .channel_create import create_channel from .channel_update import update_channel __all__ = [ "create_channel", "update_channel", ]
8
145
saleor
saleor/tests/e2e/channel/utils/channel_update.py
.py
from ...utils import get_graphql_content CHANNEL_UPDATE_MUTATION = """ mutation ChannelUpdate($id: ID!, $input: ChannelUpdateInput!) { channelUpdate(id: $id, input: $input) { channel { id orderSettings { deleteExpiredOrdersAfter allowUnpaidOrders automaticallyFulfillNonShippab...
42
912
saleor
saleor/invoice/notifications.py
.py
from typing import TYPE_CHECKING, Optional from ..core.notification.utils import get_site_context from ..core.notify import NotifyEventType, NotifyHandler from ..graphql.core.utils import to_global_id_or_none if TYPE_CHECKING: from ..account.models import User from ..app.models import App from ..plugins.m...
52
1,625
saleor
saleor/invoice/error_codes.py
.py
from enum import Enum class InvoiceErrorCode(Enum): REQUIRED = "required" NOT_READY = "not_ready" URL_NOT_SET = "url_not_set" EMAIL_NOT_SET = "email_not_set" NUMBER_NOT_SET = "number_not_set" NOT_FOUND = "not_found" INVALID_STATUS = "invalid_status" NO_INVOICE_PLUGIN = "no_invoice_plug...
13
324
saleor
saleor/invoice/models.py
.py
from django.conf import settings from django.contrib.postgres.indexes import BTreeIndex from django.db import models from django.db.models import JSONField from django.utils.timezone import now from ..app.models import App from ..core import JobStatus from ..core.models import Job, ModelWithMetadata from ..core.utils ...
91
2,763
saleor
saleor/invoice/__init__.py
.py
class InvoiceEvents: REQUESTED = "requested" REQUESTED_DELETION = "requested_deletion" CREATED = "created" DELETED = "deleted" SENT = "sent" CHOICES = [ (REQUESTED, "The invoice was requested"), (REQUESTED_DELETION, "The invoice was requested for deletion"), (CREATED, "T...
15
443
saleor
saleor/invoice/events.py
.py
from ..account.models import User from ..app.models import App from ..order.models import Order from .models import Invoice, InvoiceEvent, InvoiceEvents def invoice_requested_event( *, user: User | None, app: App | None, order: Order, number: str | None ) -> InvoiceEvent: return InvoiceEvent.objects.create( ...
69
1,751
saleor
saleor/invoice/tests/test_notifications.py
.py
from ...graphql.core.utils import to_global_id_or_none from ..models import Invoice from ..notifications import get_invoice_payload def test_collect_invoice_data_for_email(order): number = "01/12/2020/TEST" url = "http://www.example.com" invoice = Invoice.objects.create(number=number, url=url, order=order...
14
504
saleor
saleor/permission/utils.py
.py
from collections.abc import Iterable from typing import TYPE_CHECKING, Union from .auth_filters import AuthorizationFilters, resolve_authorization_filter_fn from .enums import AccountPermissions, BasePermissionEnum if TYPE_CHECKING: from ..account.models import User from ..app.models import App def all_perm...
116
3,695
saleor
saleor/permission/models.py
.py
from django.contrib import auth from django.contrib.contenttypes.models import ContentType from django.core.exceptions import PermissionDenied from django.db import models from django.utils.translation import gettext_lazy as _ def _user_has_perm(user, perm, obj): """Backend can raise `PermissionDenied` to short-c...
164
6,026
saleor
saleor/permission/apps.py
.py
from django.apps import AppConfig from django.db.models.signals import post_migrate from .management import create_permissions class AccountAppConfig(AppConfig): name = "saleor.permission" def ready(self): post_migrate.connect( create_permissions, dispatch_uid="django.contrib...
15
368
saleor
saleor/permission/enums.py
.py
from collections.abc import Iterable from enum import Enum from django.conf import settings from django.db.models import QuerySet from .models import Permission class BasePermissionEnum(Enum): @property def codename(self): return self.value.split(".")[1] class AccountPermissions(BasePermissionEnum...
183
4,888
saleor
saleor/permission/management.py
.py
from django.apps import apps as global_apps from django.contrib.auth import get_permission_codename from django.contrib.contenttypes.management import create_contenttypes from django.db import DEFAULT_DB_ALIAS, router def _get_all_permissions(opts): # noqa: D200, D212 """Return (codename, name) for all permissio...
98
3,060
saleor
saleor/permission/auth_filters.py
.py
from .enums import BasePermissionEnum def is_app(context): return bool(context.app) def is_user(context): user = context.user return user and user.is_active def is_staff_user(context): return is_user(context) and context.user.is_staff class AuthorizationFilters(BasePermissionEnum): # Grants ...
42
1,193
saleor
saleor/permission/tests/test_one_of_permissions_or_auth_filter_required.py
.py
from unittest.mock import Mock import pytest from ..auth_filters import AuthorizationFilters from ..enums import CheckoutPermissions, OrderPermissions from ..utils import all_permissions_required @pytest.mark.parametrize( ("permissions", "expected_result"), [ (None, True), ([], True), ...
316
8,902
saleor
saleor/permission/tests/test_all_permissions_required.py
.py
from unittest.mock import Mock import pytest from ..auth_filters import AuthorizationFilters from ..enums import CheckoutPermissions from ..utils import one_of_permissions_or_auth_filter_required @pytest.mark.parametrize( ("permissions", "expected_result"), [ (None, True), ([], True), ...
209
5,898
saleor
saleor/permission/tests/fixtures/permission.py
.py
import pytest from ...models import Permission @pytest.fixture def permission_manage_discounts(): return Permission.objects.get(codename="manage_discounts") @pytest.fixture def permission_manage_gift_card(): return Permission.objects.get(codename="manage_gift_card") @pytest.fixture def permission_manage_...
134
3,116
saleor
saleor/discount/error_codes.py
.py
from enum import Enum class DiscountErrorCode(Enum): ALREADY_EXISTS = "already_exists" GRAPHQL_ERROR = "graphql_error" INVALID = "invalid" NOT_FOUND = "not_found" REQUIRED = "required" UNIQUE = "unique" CANNOT_MANAGE_PRODUCT_WITHOUT_VARIANT = "cannot_manage_product_without_variant" DUP...
76
2,273
saleor
saleor/discount/models.py
.py
import datetime from decimal import ROUND_HALF_UP, Decimal from functools import partial from typing import TYPE_CHECKING, Optional from uuid import uuid4 from django.conf import settings from django.contrib.postgres.indexes import BTreeIndex, GinIndex from django.db import connection, models from django.db.models imp...
652
23,367
saleor
saleor/discount/__init__.py
.py
from dataclasses import dataclass from typing import TYPE_CHECKING if TYPE_CHECKING: from .models import PromotionRule class DiscountValueType: FIXED = "fixed" PERCENTAGE = "percentage" CHOICES = [ (FIXED, "fixed"), (PERCENTAGE, "%"), ] class DiscountType: SALE = "sale" ...
101
2,125