Skip to content

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

Test for change VoucherType from VALUE to ENTIRE_ORDER

fowczarek2d04f3afbcfd
diff --git a/tests/api/test_discount.py b/tests/api/test_discount.py
index 8eb821a2ae..fa138dd7db 100644
--- a/tests/api/test_discount.py
+++ b/tests/api/test_discount.py
@@ -174,7 +174,7 @@ def test_create_voucher(staff_api_client, permission_manage_discounts):
end_date = timezone.now() + timedelta(days=365)
variables = {
"name": "test voucher",
- "type": VoucherTypeEnum.VALUE.name,
+ "type": VoucherTypeEnum.ENTIRE_ORDER.name,
"code": "testcode123",
"discountValueType": DiscountValueTypeEnum.FIXED.name,
"discountValue": 10.12,
@@ -189,7 +189,7 @@ def test_create_voucher(staff_api_client, permission_manage_discounts):
)
content = get_graphql_content(response)
data = content["data"]["voucherCreate"]["voucher"]
- assert data["type"] == VoucherType.VALUE.upper()
+ assert data["type"] == VoucherType.ENTIRE_ORDER.upper()
assert data["minAmountSpent"]["amount"] == 1.12
assert data["name"] == "test voucher"
assert data["code"] == "testcode123"
@@ -204,7 +204,7 @@ def test_create_voucher_with_empty_code(staff_api_client, permission_manage_disc
end_date = timezone.now() + timedelta(days=365)
variables = {
"name": "test voucher",
- "type": VoucherTypeEnum.VALUE.name,
+ "type": VoucherTypeEnum.ENTIRE_ORDER.name,
"code": "",
"discountValueType": DiscountValueTypeEnum.FIXED.name,
"discountValue": 10.12,
@@ -229,7 +229,7 @@ def test_create_voucher_with_existing_gift_card_code(
end_date = timezone.now() + timedelta(days=365)
variables = {
"name": "test voucher",
- "type": VoucherTypeEnum.VALUE.name,
+ "type": VoucherTypeEnum.ENTIRE_ORDER.name,
"code": gift_card.code,
"discountValueType": DiscountValueTypeEnum.FIXED.name,
"discountValue": 10.12,
@@ -255,7 +255,7 @@ def test_create_voucher_with_existing_voucher_code(
end_date = timezone.now() + timedelta(days=365)
variables = {
"name": "test voucher",
- "type": VoucherTypeEnum.VALUE.name,
+ "type": VoucherTypeEnum.ENTIRE_ORDER.name,
"code": voucher_shipping_type.code,
"discountValueType": DiscountValueTypeEnum.FIXED.name,
"discountValue": 10.12,
diff --git a/tests/dashboard/test_discounts.py b/tests/dashboard/test_discounts.py
index 16bee7aa6d..15a23c9bf2 100644
--- a/tests/dashboard/test_discounts.py
+++ b/tests/dashboard/test_discounts.py
@@ -113,7 +113,7 @@ def test_value_voucher_order_discount(
):
voucher = Voucher(
code="unique",
- type=VoucherType.VALUE,
+ type=VoucherType.ENTIRE_ORDER,
discount_value_type=discount_type,
discount_value=discount_value,
min_amount_spent=Money(min_amount_spent, "USD")
@@ -219,7 +219,7 @@ def test_ajax_voucher_list(admin_client, voucher):
@pytest.mark.parametrize(
- "voucher_type", ["collection", "category", "product", "value", "shipping"]
+ "voucher_type", ["collection", "category", "product", "entire_order", "shipping"]
)
def test_voucher_form_min_amount_spent_is_changed_on_edit(
admin_client, product, collection, voucher_type
diff --git a/tests/test_checkout.py b/tests/test_checkout.py
index 83537e603f..7f22b58258 100644
--- a/tests/test_checkout.py
+++ b/tests/test_checkout.py
@@ -837,7 +837,7 @@ def test_get_discount_for_checkout_value_voucher(
):
voucher = Voucher(
code="unique",
- type=VoucherType.VALUE,
+ type=VoucherType.ENTIRE_ORDER,
discount_value_type=discount_type,
discount_value=discount_value,
min_amount_spent=(
@@ -884,7 +884,7 @@ def test_get_discount_for_checkout_apply_once_per_order(
def test_get_discount_for_checkout_value_voucher_not_applicable():
voucher = Voucher(
code="unique",
- type=VoucherType.VALUE,
+ type=VoucherType.ENTIRE_ORDER,
discount_value_type=DiscountValueType.FIXED,
discount_value=10,
min_amount_spent=Money(100, "USD"),
diff --git a/tests/test_discounts.py b/tests/test_discounts.py
index 766a55ce6b..5b42a24d6a 100644
--- a/tests/test_discounts.py
+++ b/tests/test_discounts.py
@@ -157,7 +157,7 @@ def test_sale_applies_to_correct_products(product_type, category):
def test_increase_voucher_usage():
voucher = Voucher.objects.create(
code="unique",
- type=VoucherType.VALUE,
+ type=VoucherType.ENTIRE_ORDER,
discount_value_type=DiscountValueType.FIXED,
discount_value=10,
usage_limit=100,
@@ -170,8 +170,8 @@ def test_increase_voucher_usage():
def test_decrease_voucher_usage():
voucher = Voucher.objects.create(
code="unique",
- type=VoucherType.VALUE,
- discount_value_type=VoucherType.VALUE,
+ type=VoucherType.ENTIRE_ORDER,
+ discount_value_type=DiscountValueType.FIXED,
discount_value=10,
usage_limit=100,
used=10,
@@ -195,7 +195,7 @@ def test_get_value_voucher_discount(
):
voucher = Voucher(
code="unique",
- type=VoucherType.VALUE,
+ type=VoucherType.ENTIRE_ORDER,
discount_value_type=discount_value_type,
discount_value=discount_value,
min_amount_spent=get_min_amount_spent(min_amount_spent),
@@ -226,7 +226,7 @@ def test_get_shipping_voucher_discount(
):
voucher = Voucher(
code="unique",
- type=VoucherType.VALUE,
+ type=VoucherType.ENTIRE_ORDER,
discount_value_type=discount_value_type,
discount_value=discount_value,
min_amount_spent=get_min_amount_spent(min_amount_spent),