Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Remove voucher type test on voucher create
Michał Jeloneka7cd4ec73fe8
diff --git a/saleor/graphql/discount/mutations.py b/saleor/graphql/discount/mutations.pyindex a7f3673e19..789de59ba7 100644--- a/saleor/graphql/discount/mutations.py+++ b/saleor/graphql/discount/mutations.py@@ -1,7 +1,7 @@import graphenefrom graphql_jwt.decorators import permission_required-from ...discount import VoucherType, models+from ...discount import modelsfrom ...discount.utils import generate_voucher_codefrom ..core.mutations import BaseMutation, ModelDeleteMutation, ModelMutationfrom ..core.scalars import Decimaldiff --git a/tests/api/test_discount.py b/tests/api/test_discount.pyindex dac72caa76..570b78b191 100644--- a/tests/api/test_discount.py+++ b/tests/api/test_discount.py@@ -243,8 +243,8 @@ def test_voucher_delete_mutation(def test_voucher_add_catalogues(- staff_api_client, voucher, category,- product, collection, permission_manage_discounts):+ staff_api_client, voucher, category, product, collection,+ permission_manage_discounts):query = """mutation voucherCataloguesAdd($id: ID!, $input: CatalogueInput!) {voucherCataloguesAdd(id: $id, input: $input) {@@ -277,8 +277,8 @@ def test_voucher_add_catalogues(def test_voucher_remove_catalogues(- staff_api_client, voucher, category,- product, collection, permission_manage_discounts):+ staff_api_client, voucher, category, product, collection,+ permission_manage_discounts):voucher.products.add(product)voucher.collections.add(collection)voucher.categories.add(category)@@ -344,8 +344,8 @@ def test_voucher_add_no_catalogues(def test_voucher_remove_no_catalogues(- staff_api_client, voucher, category,- product, collection, permission_manage_discounts):+ staff_api_client, voucher, category, product, collection,+ permission_manage_discounts):voucher.products.add(product)voucher.collections.add(collection)voucher.categories.add(category)@@ -476,8 +476,8 @@ def test_sale_delete_mutation(def test_sale_add_catalogues(- staff_api_client, sale, category,- product, collection, permission_manage_discounts):+ staff_api_client, sale, category, product, collection,+ permission_manage_discounts):query = """mutation saleCataloguesAdd($id: ID!, $input: CatalogueInput!) {saleCataloguesAdd(id: $id, input: $input) {@@ -510,8 +510,8 @@ def test_sale_add_catalogues(def test_sale_remove_catalogues(- staff_api_client, sale, category,- product, collection, permission_manage_discounts):+ staff_api_client, sale, category, product, collection,+ permission_manage_discounts):sale.products.add(product)sale.collections.add(collection)sale.categories.add(category)@@ -577,8 +577,8 @@ def test_sale_add_no_catalogues(def test_sale_remove_no_catalogues(- staff_api_client, sale, category,- product, collection, permission_manage_discounts):+ staff_api_client, sale, category, product, collection,+ permission_manage_discounts):sale.products.add(product)sale.collections.add(collection)sale.categories.add(category)@@ -608,33 +608,3 @@ def test_sale_remove_no_catalogues(assert sale.products.exists()assert sale.categories.exists()assert sale.collections.exists()--[email protected]('voucher_type,field_name', (- (VoucherTypeEnum.CATEGORY, 'categories'),- (VoucherTypeEnum.PRODUCT, 'products'),- (VoucherTypeEnum.COLLECTION, 'collections')))-def test_validate_voucher(- voucher_type, field_name, voucher,- staff_api_client, permission_manage_discounts):- query = """- mutation voucherUpdate(- $id: ID!, $type: VoucherTypeEnum) {- voucherUpdate(- id: $id, input: {type: $type}) {- errors {- field- message- }- }- }- """- staff_api_client.user.user_permissions.add(permission_manage_discounts)- response = staff_api_client.post_graphql(query, {- 'type': voucher_type.name,- 'id': graphene.Node.to_global_id('Voucher', voucher.id)})-- content = get_graphql_content(response)- data = content['data']['voucherUpdate']['errors'][0]- assert data['field'] == field_name- assert data['message'] == 'This field is required.'