Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Split storefront and dashboard APIs
Marcin Gębala77508370bdd5
diff --git a/saleor/dashboard/graphql/__init__.py b/saleor/dashboard/graphql/__init__.pynew file mode 100644index 0000000000..e69de29bb2diff --git a/saleor/dashboard/graphql/api.py b/saleor/dashboard/graphql/api.pynew file mode 100644index 0000000000..5304c4a424--- /dev/null+++ b/saleor/dashboard/graphql/api.py@@ -0,0 +1,33 @@+import graphene+from graphene_django.debug import DjangoDebug+from graphene_django.filter import DjangoFilterConnectionField++from ...graphql.core.filters import DistinctFilterSet+from ...graphql.product.types import Category, resolve_categories+from ...graphql.utils import get_node+from .product.mutations import (+ CategoryCreateMutation, CategoryUpdateMutation, CategoryDelete)+++class Query(graphene.ObjectType):+ categories = DjangoFilterConnectionField(+ Category, filterset_class=DistinctFilterSet,+ level=graphene.Argument(graphene.Int))+ category = graphene.Field(Category, id=graphene.Argument(graphene.ID))+ node = graphene.Node.Field()+ debug = graphene.Field(DjangoDebug, name='__debug')++ def resolve_category(self, info, id):+ return get_node(info, id, only_type=Category)++ def resolve_categories(self, info, level=None):+ return resolve_categories(info, level)+++class Mutations(graphene.ObjectType):+ category_create = CategoryCreateMutation.Field()+ category_delete = CategoryDelete.Field()+ category_update = CategoryUpdateMutation.Field()+++schema = graphene.Schema(Query, Mutations)diff --git a/saleor/graphql/core/mutations.py b/saleor/dashboard/graphql/mutations.pysimilarity index 97%rename from saleor/graphql/core/mutations.pyrename to saleor/dashboard/graphql/mutations.pyindex 58f556622c..4fd4a4d269 100644--- a/saleor/graphql/core/mutations.py+++ b/saleor/dashboard/graphql/mutations.py@@ -7,8 +7,8 @@ from graphene.types.mutation import MutationOptionsfrom graphene_django.form_converter import convert_form_fieldfrom graphene_django.registry import get_global_registry-from ..utils import get_node-from .types import Error+from ...graphql.utils import get_node+from ...graphql.core.types import Errorregistry = get_global_registry()diff --git a/saleor/dashboard/graphql/product/__init__.py b/saleor/dashboard/graphql/product/__init__.pynew file mode 100644index 0000000000..e69de29bb2diff --git a/saleor/graphql/product/mutations.py b/saleor/dashboard/graphql/product/mutations.pysimilarity index 84%rename from saleor/graphql/product/mutations.pyrename to saleor/dashboard/graphql/product/mutations.pyindex d42238c14a..5042bd41b3 100644--- a/saleor/graphql/product/mutations.py+++ b/saleor/dashboard/graphql/product/mutations.py@@ -1,9 +1,10 @@import graphene-from ...dashboard.category.forms import CategoryForm-from ..core.mutations import BaseMutation, ModelFormMutation, ModelFormUpdateMutation-from ..utils import get_node-from .types import Category+from ....graphql.product.types import Category+from ....graphql.utils import get_node+from ...category.forms import CategoryForm+from ..mutations import (+ BaseMutation, ModelFormMutation, ModelFormUpdateMutation)class CategoryCreateMutation(ModelFormMutation):diff --git a/saleor/dashboard/urls.py b/saleor/dashboard/urls.pyindex 838adf3fb7..54bf4ba231 100644--- a/saleor/dashboard/urls.py+++ b/saleor/dashboard/urls.py@@ -1,10 +1,13 @@+from django.conf import settingsfrom django.conf.urls import include, url+from graphene_django.views import GraphQLViewfrom . import views as core_viewsfrom .category.urls import urlpatterns as category_urlsfrom .collection.urls import urlpatterns as collection_urlsfrom .customer.urls import urlpatterns as customer_urlsfrom .discount.urls import urlpatterns as discount_urls+from .graphql.api import schemafrom .group.urls import urlpatterns as groups_urlsfrom .order.urls import urlpatterns as order_urlsfrom .product.urls import urlpatterns as product_urls@@ -21,6 +24,8 @@ urlpatterns = [url(r'^products/', include(product_urls)),url(r'^customers/', include(customer_urls)),url(r'^staff/', include(staff_urls)),+ url(r'^graphql/', GraphQLView.as_view(+ schema=schema, graphiql=settings.DEBUG), name='api'),url(r'^groups/', include(groups_urls)),url(r'^discounts/', include(discount_urls)),url(r'^settings/', include(site_urls)),diff --git a/saleor/graphql/api.py b/saleor/graphql/api.pyindex 86034d7e42..9764868f59 100644--- a/saleor/graphql/api.py+++ b/saleor/graphql/api.py@@ -7,8 +7,6 @@ from .product.filters import ProductFilterSetfrom .product.types import (Category, ProductAttribute, Product, resolve_attributes, resolve_products,resolve_categories)-from .product.mutations import (- CategoryCreateMutation, CategoryUpdateMutation, CategoryDelete)from .utils import get_node@@ -43,10 +41,4 @@ class Query(graphene.ObjectType):return resolve_attributes(in_category, info)-class Mutations(graphene.ObjectType):- category_create = CategoryCreateMutation.Field()- category_delete = CategoryDelete.Field()- category_update = CategoryUpdateMutation.Field()---schema = graphene.Schema(Query, Mutations)+schema = graphene.Schema(Query)diff --git a/saleor/settings.py b/saleor/settings.pyindex 13459ef4ee..d2428b742e 100644--- a/saleor/settings.py+++ b/saleor/settings.py@@ -358,10 +358,7 @@ if ES_URL:GRAPHENE = {'MIDDLEWARE': [- 'graphene_django.debug.DjangoDebugMiddleware'],- 'SCHEMA': 'saleor.graphql.api.schema',- 'SCHEMA_OUTPUT': os.path.join(- PROJECT_ROOT, 'saleor', 'static', 'schema.json')}+ 'graphene_django.debug.DjangoDebugMiddleware'],}AUTHENTICATION_BACKENDS = ['saleor.account.backends.facebook.CustomFacebookOAuth2',diff --git a/saleor/static/schema.json b/saleor/static/schema.jsondeleted file mode 100644index ff56ea3e70..0000000000--- a/saleor/static/schema.json+++ /dev/null@@ -1 +0,0 @@-{"data": {"__schema": {"queryType": {"name": "Query"}, "mutationType": null, "subscriptionType": null, "types": [{"kind": "OBJECT", "name": "Query", "description": null, "fields": [{"name": "attributes", "description": null, "args": [{"name": "inCategory", "description": null, "type": {"kind": "SCALAR", "name": "ID", "ofType": null}, "defaultValue": null}, {"name": "before", "description": null, "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "defaultValue": null}, {"name": "after", "description": null, "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "defaultValue": null}, {"name": "first", "description": null, "type": {"kind": "SCALAR", "name": "Int", "ofType": null}, "defaultValue": null}, {"name": "last", "description": null, "type": {"kind": "SCALAR", "name": "Int", "ofType": null}, "defaultValue": null}], "type": {"kind": "OBJECT", "name": "ProductAttributeCountableConnection", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "categories", "description": null, "args": [{"name": "before", "description": null, "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "defaultValue": null}, {"name": "after", "description": null, "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "defaultValue": null}, {"name": "first", "description": null, "type": {"kind": "SCALAR", "name": "Int", "ofType": null}, "defaultValue": null}, {"name": "last", "description": null, "type": {"kind": "SCALAR", "name": "Int", "ofType": null}, "defaultValue": null}], "type": {"kind": "OBJECT", "name": "CategoryCountableConnection", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "category", "description": null, "args": [{"name": "id", "description": null, "type": {"kind": "SCALAR", "name": "ID", "ofType": null}, "defaultValue": null}], "type": {"kind": "OBJECT", "name": "Category", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "product", "description": null, "args": [{"name": "id", "description": null, "type": {"kind": "SCALAR", "name": "ID", "ofType": null}, "defaultValue": null}], "type": {"kind": "OBJECT", "name": "Product", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "products", "description": null, "args": [{"name": "before", "description": null, "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "defaultValue": null}, {"name": "after", "description": null, "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "defaultValue": null}, {"name": "first", "description": null, "type": {"kind": "SCALAR", "name": "Int", "ofType": null}, "defaultValue": null}, {"name": "last", "description": null, "type": {"kind": "SCALAR", "name": "Int", "ofType": null}, "defaultValue": null}, {"name": "category", "description": null, "type": {"kind": "SCALAR", "name": "ID", "ofType": null}, "defaultValue": null}, {"name": "price", "description": null, "type": {"kind": "SCALAR", "name": "Float", "ofType": null}, "defaultValue": null}, {"name": "price_Range", "description": null, "type": {"kind": "SCALAR", "name": "Float", "ofType": null}, "defaultValue": null}, {"name": "price_Lte", "description": null, "type": {"kind": "SCALAR", "name": "Float", "ofType": null}, "defaultValue": null}, {"name": "price_Gte", "description": null, "type": {"kind": "SCALAR", "name": "Float", "ofType": null}, "defaultValue": null}, {"name": "attributes", "description": null, "type": {"kind": "LIST", "name": null, "ofType": {"kind": "SCALAR", "name": "String", "ofType": null}}, "defaultValue": null}], "type": {"kind": "OBJECT", "name": "ProductCountableConnection", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "node", "description": "The ID of the object", "args": [{"name": "id", "description": null, "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "ID", "ofType": null}}, "defaultValue": null}], "type": {"kind": "INTERFACE", "name": "Node", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "__debug", "description": null, "args": [], "type": {"kind": "OBJECT", "name": "DjangoDebug", "ofType": null}, "isDeprecated": false, "deprecationReason": null}], "inputFields": null, "interfaces": [], "enumValues": null, "possibleTypes": null}, {"kind": "OBJECT", "name": "ProductAttributeCountableConnection", "description": null, "fields": [{"name": "pageInfo", "description": null, "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "OBJECT", "name": "PageInfo", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "edges", "description": null, "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "LIST", "name": null, "ofType": {"kind": "OBJECT", "name": "ProductAttributeCountableEdge", "ofType": null}}}, "isDeprecated": false, "deprecationReason": null}, {"name": "totalCount", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "Int", "ofType": null}, "isDeprecated": false, "deprecationReason": null}], "inputFields": null, "interfaces": [], "enumValues": null, "possibleTypes": null}, {"kind": "OBJECT", "name": "PageInfo", "description": null, "fields": [{"name": "hasNextPage", "description": "When paginating forwards, are there more items?", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "Boolean", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "hasPreviousPage", "description": "When paginating backwards, are there more items?", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "Boolean", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "startCursor", "description": "When paginating backwards, the cursor to continue.", "args": [], "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "endCursor", "description": "When paginating forwards, the cursor to continue.", "args": [], "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "isDeprecated": false, "deprecationReason": null}], "inputFields": null, "interfaces": [], "enumValues": null, "possibleTypes": null}, {"kind": "SCALAR", "name": "Boolean", "description": "The `Boolean` scalar type represents `true` or `false`.", "fields": null, "inputFields": null, "interfaces": null, "enumValues": null, "possibleTypes": null}, {"kind": "SCALAR", "name": "String", "description": "The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.", "fields": null, "inputFields": null, "interfaces": null, "enumValues": null, "possibleTypes": null}, {"kind": "OBJECT", "name": "ProductAttributeCountableEdge", "description": null, "fields": [{"name": "node", "description": "The item at the end of the edge", "args": [], "type": {"kind": "OBJECT", "name": "ProductAttribute", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "cursor", "description": "A cursor for use in pagination", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "String", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}], "inputFields": null, "interfaces": [], "enumValues": null, "possibleTypes": null}, {"kind": "OBJECT", "name": "ProductAttribute", "description": null, "fields": [{"name": "id", "description": "The ID of the object.", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "ID", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "slug", "description": "", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "String", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "name", "description": "", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "String", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "values", "description": null, "args": [], "type": {"kind": "LIST", "name": null, "ofType": {"kind": "OBJECT", "name": "ProductAttributeValue", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}], "inputFields": null, "interfaces": [{"kind": "INTERFACE", "name": "Node", "ofType": null}], "enumValues": null, "possibleTypes": null}, {"kind": "INTERFACE", "name": "Node", "description": "An object with an ID", "fields": [{"name": "id", "description": "The ID of the object.", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "ID", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}], "inputFields": null, "interfaces": null, "enumValues": null, "possibleTypes": [{"kind": "OBJECT", "name": "ProductAttribute", "ofType": null}, {"kind": "OBJECT", "name": "ProductAttributeValue", "ofType": null}, {"kind": "OBJECT", "name": "Category", "ofType": null}, {"kind": "OBJECT", "name": "Product", "ofType": null}, {"kind": "OBJECT", "name": "ProductVariant", "ofType": null}, {"kind": "OBJECT", "name": "ProductImage", "ofType": null}]}, {"kind": "SCALAR", "name": "ID", "description": "The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `\"4\"`) or integer (such as `4`) input value will be accepted as an ID.", "fields": null, "inputFields": null, "interfaces": null, "enumValues": null, "possibleTypes": null}, {"kind": "OBJECT", "name": "ProductAttributeValue", "description": null, "fields": [{"name": "id", "description": "The ID of the object.", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "ID", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "name", "description": "", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "String", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "slug", "description": "", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "String", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "color", "description": "", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "String", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "attribute", "description": "", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "OBJECT", "name": "ProductAttribute", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}], "inputFields": null, "interfaces": [{"kind": "INTERFACE", "name": "Node", "ofType": null}], "enumValues": null, "possibleTypes": null}, {"kind": "SCALAR", "name": "Int", "description": "The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^53 - 1) and 2^53 - 1 since represented in JSON as double-precision floating point numbers specifiedby [IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point).", "fields": null, "inputFields": null, "interfaces": null, "enumValues": null, "possibleTypes": null}, {"kind": "OBJECT", "name": "CategoryCountableConnection", "description": null, "fields": [{"name": "pageInfo", "description": null, "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "OBJECT", "name": "PageInfo", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "edges", "description": null, "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "LIST", "name": null, "ofType": {"kind": "OBJECT", "name": "CategoryCountableEdge", "ofType": null}}}, "isDeprecated": false, "deprecationReason": null}, {"name": "totalCount", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "Int", "ofType": null}, "isDeprecated": false, "deprecationReason": null}], "inputFields": null, "interfaces": [], "enumValues": null, "possibleTypes": null}, {"kind": "OBJECT", "name": "CategoryCountableEdge", "description": null, "fields": [{"name": "node", "description": "The item at the end of the edge", "args": [], "type": {"kind": "OBJECT", "name": "Category", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "cursor", "description": "A cursor for use in pagination", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "String", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}], "inputFields": null, "interfaces": [], "enumValues": null, "possibleTypes": null}, {"kind": "OBJECT", "name": "Category", "description": null, "fields": [{"name": "id", "description": "The ID of the object.", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "ID", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "name", "description": "", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "String", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "slug", "description": "", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "String", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "description", "description": "", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "String", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "parent", "description": "", "args": [], "type": {"kind": "OBJECT", "name": "Category", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "lft", "description": "", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "Int", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "rght", "description": "", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "Int", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "treeId", "description": "", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "Int", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "level", "description": "", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "Int", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "children", "description": null, "args": [{"name": "before", "description": null, "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "defaultValue": null}, {"name": "after", "description": null, "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "defaultValue": null}, {"name": "first", "description": null, "type": {"kind": "SCALAR", "name": "Int", "ofType": null}, "defaultValue": null}, {"name": "last", "description": null, "type": {"kind": "SCALAR", "name": "Int", "ofType": null}, "defaultValue": null}], "type": {"kind": "OBJECT", "name": "CategoryCountableConnection", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "products", "description": null, "args": [{"name": "sortBy", "description": null, "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "defaultValue": null}, {"name": "before", "description": null, "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "defaultValue": null}, {"name": "after", "description": null, "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "defaultValue": null}, {"name": "first", "description": null, "type": {"kind": "SCALAR", "name": "Int", "ofType": null}, "defaultValue": null}, {"name": "last", "description": null, "type": {"kind": "SCALAR", "name": "Int", "ofType": null}, "defaultValue": null}, {"name": "category", "description": null, "type": {"kind": "SCALAR", "name": "ID", "ofType": null}, "defaultValue": null}, {"name": "price", "description": null, "type": {"kind": "SCALAR", "name": "Float", "ofType": null}, "defaultValue": null}, {"name": "price_Range", "description": null, "type": {"kind": "SCALAR", "name": "Float", "ofType": null}, "defaultValue": null}, {"name": "price_Lte", "description": null, "type": {"kind": "SCALAR", "name": "Float", "ofType": null}, "defaultValue": null}, {"name": "price_Gte", "description": null, "type": {"kind": "SCALAR", "name": "Float", "ofType": null}, "defaultValue": null}, {"name": "attributes", "description": null, "type": {"kind": "LIST", "name": null, "ofType": {"kind": "SCALAR", "name": "String", "ofType": null}}, "defaultValue": null}], "type": {"kind": "OBJECT", "name": "ProductCountableConnection", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "productsCount", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "Int", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "url", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "ancestors", "description": null, "args": [{"name": "before", "description": null, "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "defaultValue": null}, {"name": "after", "description": null, "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "defaultValue": null}, {"name": "first", "description": null, "type": {"kind": "SCALAR", "name": "Int", "ofType": null}, "defaultValue": null}, {"name": "last", "description": null, "type": {"kind": "SCALAR", "name": "Int", "ofType": null}, "defaultValue": null}], "type": {"kind": "OBJECT", "name": "CategoryCountableConnection", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "siblings", "description": null, "args": [{"name": "before", "description": null, "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "defaultValue": null}, {"name": "after", "description": null, "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "defaultValue": null}, {"name": "first", "description": null, "type": {"kind": "SCALAR", "name": "Int", "ofType": null}, "defaultValue": null}, {"name": "last", "description": null, "type": {"kind": "SCALAR", "name": "Int", "ofType": null}, "defaultValue": null}], "type": {"kind": "OBJECT", "name": "CategoryCountableConnection", "ofType": null}, "isDeprecated": false, "deprecationReason": null}], "inputFields": null, "interfaces": [{"kind": "INTERFACE", "name": "Node", "ofType": null}], "enumValues": null, "possibleTypes": null}, {"kind": "OBJECT", "name": "ProductCountableConnection", "description": null, "fields": [{"name": "pageInfo", "description": null, "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "OBJECT", "name": "PageInfo", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "edges", "description": null, "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "LIST", "name": null, "ofType": {"kind": "OBJECT", "name": "ProductCountableEdge", "ofType": null}}}, "isDeprecated": false, "deprecationReason": null}, {"name": "totalCount", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "Int", "ofType": null}, "isDeprecated": false, "deprecationReason": null}], "inputFields": null, "interfaces": [], "enumValues": null, "possibleTypes": null}, {"kind": "OBJECT", "name": "ProductCountableEdge", "description": null, "fields": [{"name": "node", "description": "The item at the end of the edge", "args": [], "type": {"kind": "OBJECT", "name": "Product", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "cursor", "description": "A cursor for use in pagination", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "String", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}], "inputFields": null, "interfaces": [], "enumValues": null, "possibleTypes": null}, {"kind": "OBJECT", "name": "Product", "description": null, "fields": [{"name": "id", "description": "The ID of the object.", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "ID", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "name", "description": "", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "String", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "description", "description": "", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "String", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "category", "description": "", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "OBJECT", "name": "Category", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "price", "description": null, "args": [], "type": {"kind": "OBJECT", "name": "Price", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "availableOn", "description": "", "args": [], "type": {"kind": "SCALAR", "name": "DateTime", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "isPublished", "description": "", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "Boolean", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "attributes", "description": "", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "JSONString", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "updatedAt", "description": "", "args": [], "type": {"kind": "SCALAR", "name": "DateTime", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "isFeatured", "description": "", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "Boolean", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "variants", "description": null, "args": [], "type": {"kind": "LIST", "name": null, "ofType": {"kind": "OBJECT", "name": "ProductVariant", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "images", "description": null, "args": [], "type": {"kind": "LIST", "name": null, "ofType": {"kind": "OBJECT", "name": "ProductImage", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "url", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "thumbnailUrl", "description": null, "args": [{"name": "size", "description": "The size of a thumbnail, for example 255x255", "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "defaultValue": null}], "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "availability", "description": null, "args": [], "type": {"kind": "OBJECT", "name": "ProductAvailability", "ofType": null}, "isDeprecated": false, "deprecationReason": null}], "inputFields": null, "interfaces": [{"kind": "INTERFACE", "name": "Node", "ofType": null}], "enumValues": null, "possibleTypes": null}, {"kind": "OBJECT", "name": "Price", "description": null, "fields": [{"name": "currency", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "gross", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "Float", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "grossLocalized", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "net", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "Float", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "netLocalized", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "isDeprecated": false, "deprecationReason": null}], "inputFields": null, "interfaces": [], "enumValues": null, "possibleTypes": null}, {"kind": "SCALAR", "name": "Float", "description": "The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point). ", "fields": null, "inputFields": null, "interfaces": null, "enumValues": null, "possibleTypes": null}, {"kind": "SCALAR", "name": "DateTime", "description": "The `DateTime` scalar type represents a DateTime\nvalue as specified by\n[iso8601](https://en.wikipedia.org/wiki/ISO_8601).", "fields": null, "inputFields": null, "interfaces": null, "enumValues": null, "possibleTypes": null}, {"kind": "SCALAR", "name": "JSONString", "description": "JSON String", "fields": null, "inputFields": null, "interfaces": null, "enumValues": null, "possibleTypes": null}, {"kind": "OBJECT", "name": "ProductVariant", "description": null, "fields": [{"name": "id", "description": "The ID of the object.", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "ID", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "sku", "description": "", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "String", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "name", "description": "", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "String", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "priceOverride", "description": null, "args": [], "type": {"kind": "OBJECT", "name": "Price", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "product", "description": "", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "OBJECT", "name": "Product", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "attributes", "description": "", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "JSONString", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "images", "description": null, "args": [{"name": "before", "description": null, "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "defaultValue": null}, {"name": "after", "description": null, "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "defaultValue": null}, {"name": "first", "description": null, "type": {"kind": "SCALAR", "name": "Int", "ofType": null}, "defaultValue": null}, {"name": "last", "description": null, "type": {"kind": "SCALAR", "name": "Int", "ofType": null}, "defaultValue": null}], "type": {"kind": "OBJECT", "name": "ProductImageCountableConnection", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "stockQuantity", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "Int", "ofType": null}, "isDeprecated": false, "deprecationReason": null}], "inputFields": null, "interfaces": [{"kind": "INTERFACE", "name": "Node", "ofType": null}], "enumValues": null, "possibleTypes": null}, {"kind": "OBJECT", "name": "ProductImageCountableConnection", "description": null, "fields": [{"name": "pageInfo", "description": null, "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "OBJECT", "name": "PageInfo", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "edges", "description": null, "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "LIST", "name": null, "ofType": {"kind": "OBJECT", "name": "ProductImageCountableEdge", "ofType": null}}}, "isDeprecated": false, "deprecationReason": null}, {"name": "totalCount", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "Int", "ofType": null}, "isDeprecated": false, "deprecationReason": null}], "inputFields": null, "interfaces": [], "enumValues": null, "possibleTypes": null}, {"kind": "OBJECT", "name": "ProductImageCountableEdge", "description": null, "fields": [{"name": "node", "description": "The item at the end of the edge", "args": [], "type": {"kind": "OBJECT", "name": "ProductImage", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "cursor", "description": "A cursor for use in pagination", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "String", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}], "inputFields": null, "interfaces": [], "enumValues": null, "possibleTypes": null}, {"kind": "OBJECT", "name": "ProductImage", "description": null, "fields": [{"name": "id", "description": "The ID of the object.", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "ID", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "product", "description": "", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "OBJECT", "name": "Product", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "image", "description": "", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "String", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "ppoi", "description": "", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "String", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "alt", "description": "", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "String", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "order", "description": "", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "Int", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "productvariantSet", "description": null, "args": [{"name": "before", "description": null, "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "defaultValue": null}, {"name": "after", "description": null, "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "defaultValue": null}, {"name": "first", "description": null, "type": {"kind": "SCALAR", "name": "Int", "ofType": null}, "defaultValue": null}, {"name": "last", "description": null, "type": {"kind": "SCALAR", "name": "Int", "ofType": null}, "defaultValue": null}], "type": {"kind": "OBJECT", "name": "ProductVariantCountableConnection", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "url", "description": null, "args": [{"name": "size", "description": null, "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "defaultValue": null}], "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "isDeprecated": false, "deprecationReason": null}], "inputFields": null, "interfaces": [{"kind": "INTERFACE", "name": "Node", "ofType": null}], "enumValues": null, "possibleTypes": null}, {"kind": "OBJECT", "name": "ProductVariantCountableConnection", "description": null, "fields": [{"name": "pageInfo", "description": null, "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "OBJECT", "name": "PageInfo", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "edges", "description": null, "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "LIST", "name": null, "ofType": {"kind": "OBJECT", "name": "ProductVariantCountableEdge", "ofType": null}}}, "isDeprecated": false, "deprecationReason": null}, {"name": "totalCount", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "Int", "ofType": null}, "isDeprecated": false, "deprecationReason": null}], "inputFields": null, "interfaces": [], "enumValues": null, "possibleTypes": null}, {"kind": "OBJECT", "name": "ProductVariantCountableEdge", "description": null, "fields": [{"name": "node", "description": "The item at the end of the edge", "args": [], "type": {"kind": "OBJECT", "name": "ProductVariant", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "cursor", "description": "A cursor for use in pagination", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "String", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}], "inputFields": null, "interfaces": [], "enumValues": null, "possibleTypes": null}, {"kind": "OBJECT", "name": "ProductAvailability", "description": null, "fields": [{"name": "available", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "Boolean", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "onSale", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "Boolean", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "discount", "description": null, "args": [], "type": {"kind": "OBJECT", "name": "Price", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "discountLocalCurrency", "description": null, "args": [], "type": {"kind": "OBJECT", "name": "Price", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "priceRange", "description": null, "args": [], "type": {"kind": "OBJECT", "name": "PriceRange", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "priceRangeUndiscounted", "description": null, "args": [], "type": {"kind": "OBJECT", "name": "PriceRange", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "priceRangeLocalCurrency", "description": null, "args": [], "type": {"kind": "OBJECT", "name": "PriceRange", "ofType": null}, "isDeprecated": false, "deprecationReason": null}], "inputFields": null, "interfaces": [], "enumValues": null, "possibleTypes": null}, {"kind": "OBJECT", "name": "PriceRange", "description": null, "fields": [{"name": "maxPrice", "description": null, "args": [], "type": {"kind": "OBJECT", "name": "Price", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "minPrice", "description": null, "args": [], "type": {"kind": "OBJECT", "name": "Price", "ofType": null}, "isDeprecated": false, "deprecationReason": null}], "inputFields": null, "interfaces": [], "enumValues": null, "possibleTypes": null}, {"kind": "OBJECT", "name": "DjangoDebug", "description": null, "fields": [{"name": "sql", "description": null, "args": [], "type": {"kind": "LIST", "name": null, "ofType": {"kind": "OBJECT", "name": "DjangoDebugSQL", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}], "inputFields": null, "interfaces": [], "enumValues": null, "possibleTypes": null}, {"kind": "OBJECT", "name": "DjangoDebugSQL", "description": null, "fields": [{"name": "vendor", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "alias", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "sql", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "duration", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "Float", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "rawSql", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "params", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "startTime", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "Float", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "stopTime", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "Float", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "isSlow", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "Boolean", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "isSelect", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "Boolean", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "transId", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "transStatus", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "isoLevel", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "encoding", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "isDeprecated": false, "deprecationReason": null}], "inputFields": null, "interfaces": [], "enumValues": null, "possibleTypes": null}, {"kind": "OBJECT", "name": "__Schema", "description": "A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation and subscription operations.", "fields": [{"name": "types", "description": "A list of all types supported by this server.", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "LIST", "name": null, "ofType": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "OBJECT", "name": "__Type", "ofType": null}}}}, "isDeprecated": false, "deprecationReason": null}, {"name": "queryType", "description": "The type that query operations will be rooted at.", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "OBJECT", "name": "__Type", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "mutationType", "description": "If this server supports mutation, the type that mutation operations will be rooted at.", "args": [], "type": {"kind": "OBJECT", "name": "__Type", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "subscriptionType", "description": "If this server support subscription, the type that subscription operations will be rooted at.", "args": [], "type": {"kind": "OBJECT", "name": "__Type", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "directives", "description": "A list of all directives supported by this server.", "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "LIST", "name": null, "ofType": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "OBJECT", "name": "__Directive", "ofType": null}}}}, "isDeprecated": false, "deprecationReason": null}], "inputFields": null, "interfaces": [], "enumValues": null, "possibleTypes": null}, {"kind": "OBJECT", "name": "__Type", "description": "The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name and description, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.", "fields": [{"name": "kind", "description": null, "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "ENUM", "name": "__TypeKind", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "name", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "description", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "fields", "description": null, "args": [{"name": "includeDeprecated", "description": null, "type": {"kind": "SCALAR", "name": "Boolean", "ofType": null}, "defaultValue": "false"}], "type": {"kind": "LIST", "name": null, "ofType": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "OBJECT", "name": "__Field", "ofType": null}}}, "isDeprecated": false, "deprecationReason": null}, {"name": "interfaces", "description": null, "args": [], "type": {"kind": "LIST", "name": null, "ofType": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "OBJECT", "name": "__Type", "ofType": null}}}, "isDeprecated": false, "deprecationReason": null}, {"name": "possibleTypes", "description": null, "args": [], "type": {"kind": "LIST", "name": null, "ofType": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "OBJECT", "name": "__Type", "ofType": null}}}, "isDeprecated": false, "deprecationReason": null}, {"name": "enumValues", "description": null, "args": [{"name": "includeDeprecated", "description": null, "type": {"kind": "SCALAR", "name": "Boolean", "ofType": null}, "defaultValue": "false"}], "type": {"kind": "LIST", "name": null, "ofType": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "OBJECT", "name": "__EnumValue", "ofType": null}}}, "isDeprecated": false, "deprecationReason": null}, {"name": "inputFields", "description": null, "args": [], "type": {"kind": "LIST", "name": null, "ofType": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "OBJECT", "name": "__InputValue", "ofType": null}}}, "isDeprecated": false, "deprecationReason": null}, {"name": "ofType", "description": null, "args": [], "type": {"kind": "OBJECT", "name": "__Type", "ofType": null}, "isDeprecated": false, "deprecationReason": null}], "inputFields": null, "interfaces": [], "enumValues": null, "possibleTypes": null}, {"kind": "ENUM", "name": "__TypeKind", "description": "An enum describing what kind of type a given `__Type` is", "fields": null, "inputFields": null, "interfaces": null, "enumValues": [{"name": "SCALAR", "description": "Indicates this type is a scalar.", "isDeprecated": false, "deprecationReason": null}, {"name": "OBJECT", "description": "Indicates this type is an object. `fields` and `interfaces` are valid fields.", "isDeprecated": false, "deprecationReason": null}, {"name": "INTERFACE", "description": "Indicates this type is an interface. `fields` and `possibleTypes` are valid fields.", "isDeprecated": false, "deprecationReason": null}, {"name": "UNION", "description": "Indicates this type is a union. `possibleTypes` is a valid field.", "isDeprecated": false, "deprecationReason": null}, {"name": "ENUM", "description": "Indicates this type is an enum. `enumValues` is a valid field.", "isDeprecated": false, "deprecationReason": null}, {"name": "INPUT_OBJECT", "description": "Indicates this type is an input object. `inputFields` is a valid field.", "isDeprecated": false, "deprecationReason": null}, {"name": "LIST", "description": "Indicates this type is a list. `ofType` is a valid field.", "isDeprecated": false, "deprecationReason": null}, {"name": "NON_NULL", "description": "Indicates this type is a non-null. `ofType` is a valid field.", "isDeprecated": false, "deprecationReason": null}], "possibleTypes": null}, {"kind": "OBJECT", "name": "__Field", "description": "Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.", "fields": [{"name": "name", "description": null, "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "String", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "description", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "args", "description": null, "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "LIST", "name": null, "ofType": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "OBJECT", "name": "__InputValue", "ofType": null}}}}, "isDeprecated": false, "deprecationReason": null}, {"name": "type", "description": null, "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "OBJECT", "name": "__Type", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "isDeprecated", "description": null, "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "Boolean", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "deprecationReason", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "isDeprecated": false, "deprecationReason": null}], "inputFields": null, "interfaces": [], "enumValues": null, "possibleTypes": null}, {"kind": "OBJECT", "name": "__InputValue", "description": "Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.", "fields": [{"name": "name", "description": null, "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "String", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "description", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "type", "description": null, "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "OBJECT", "name": "__Type", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "defaultValue", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "isDeprecated": false, "deprecationReason": null}], "inputFields": null, "interfaces": [], "enumValues": null, "possibleTypes": null}, {"kind": "OBJECT", "name": "__EnumValue", "description": "One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.", "fields": [{"name": "name", "description": null, "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "String", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "description", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "isDeprecated", "description": null, "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "Boolean", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "deprecationReason", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "isDeprecated": false, "deprecationReason": null}], "inputFields": null, "interfaces": [], "enumValues": null, "possibleTypes": null}, {"kind": "OBJECT", "name": "__Directive", "description": "A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\n\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.", "fields": [{"name": "name", "description": null, "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "String", "ofType": null}}, "isDeprecated": false, "deprecationReason": null}, {"name": "description", "description": null, "args": [], "type": {"kind": "SCALAR", "name": "String", "ofType": null}, "isDeprecated": false, "deprecationReason": null}, {"name": "locations", "description": null, "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "LIST", "name": null, "ofType": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "ENUM", "name": "__DirectiveLocation", "ofType": null}}}}, "isDeprecated": false, "deprecationReason": null}, {"name": "args", "description": null, "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "LIST", "name": null, "ofType": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "OBJECT", "name": "__InputValue", "ofType": null}}}}, "isDeprecated": false, "deprecationReason": null}, {"name": "onOperation", "description": null, "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "Boolean", "ofType": null}}, "isDeprecated": true, "deprecationReason": "Use `locations`."}, {"name": "onFragment", "description": null, "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "Boolean", "ofType": null}}, "isDeprecated": true, "deprecationReason": "Use `locations`."}, {"name": "onField", "description": null, "args": [], "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "Boolean", "ofType": null}}, "isDeprecated": true, "deprecationReason": "Use `locations`."}], "inputFields": null, "interfaces": [], "enumValues": null, "possibleTypes": null}, {"kind": "ENUM", "name": "__DirectiveLocation", "description": "A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.", "fields": null, "inputFields": null, "interfaces": null, "enumValues": [{"name": "QUERY", "description": "Location adjacent to a query operation.", "isDeprecated": false, "deprecationReason": null}, {"name": "MUTATION", "description": "Location adjacent to a mutation operation.", "isDeprecated": false, "deprecationReason": null}, {"name": "SUBSCRIPTION", "description": "Location adjacent to a subscription operation.", "isDeprecated": false, "deprecationReason": null}, {"name": "FIELD", "description": "Location adjacent to a field.", "isDeprecated": false, "deprecationReason": null}, {"name": "FRAGMENT_DEFINITION", "description": "Location adjacent to a fragment definition.", "isDeprecated": false, "deprecationReason": null}, {"name": "FRAGMENT_SPREAD", "description": "Location adjacent to a fragment spread.", "isDeprecated": false, "deprecationReason": null}, {"name": "INLINE_FRAGMENT", "description": "Location adjacent to an inline fragment.", "isDeprecated": false, "deprecationReason": null}, {"name": "SCHEMA", "description": "Location adjacent to a schema definition.", "isDeprecated": false, "deprecationReason": null}, {"name": "SCALAR", "description": "Location adjacent to a scalar definition.", "isDeprecated": false, "deprecationReason": null}, {"name": "OBJECT", "description": "Location adjacent to an object definition.", "isDeprecated": false, "deprecationReason": null}, {"name": "FIELD_DEFINITION", "description": "Location adjacent to a field definition.", "isDeprecated": false, "deprecationReason": null}, {"name": "ARGUMENT_DEFINITION", "description": "Location adjacent to an argument definition.", "isDeprecated": false, "deprecationReason": null}, {"name": "INTERFACE", "description": "Location adjacent to an interface definition.", "isDeprecated": false, "deprecationReason": null}, {"name": "UNION", "description": "Location adjacent to a union definition.", "isDeprecated": false, "deprecationReason": null}, {"name": "ENUM", "description": "Location adjacent to an enum definition.", "isDeprecated": false, "deprecationReason": null}, {"name": "ENUM_VALUE", "description": "Location adjacent to an enum value definition.", "isDeprecated": false, "deprecationReason": null}, {"name": "INPUT_OBJECT", "description": "Location adjacent to an input object definition.", "isDeprecated": false, "deprecationReason": null}, {"name": "INPUT_FIELD_DEFINITION", "description": "Location adjacent to an input object field definition.", "isDeprecated": false, "deprecationReason": null}], "possibleTypes": null}], "directives": [{"name": "include", "description": "Directs the executor to include this field or fragment only when the `if` argument is true.", "locations": ["FIELD", "FRAGMENT_SPREAD", "INLINE_FRAGMENT"], "args": [{"name": "if", "description": "Included when true.", "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "Boolean", "ofType": null}}, "defaultValue": null}]}, {"name": "skip", "description": "Directs the executor to skip this field or fragment when the `if` argument is true.", "locations": ["FIELD", "FRAGMENT_SPREAD", "INLINE_FRAGMENT"], "args": [{"name": "if", "description": "Skipped when true.", "type": {"kind": "NON_NULL", "name": null, "ofType": {"kind": "SCALAR", "name": "Boolean", "ofType": null}}, "defaultValue": null}]}]}}}\ No newline at end of filediff --git a/saleor/urls.py b/saleor/urls.pyindex 32199245da..1bffdbc888 100644--- a/saleor/urls.py+++ b/saleor/urls.py@@ -13,6 +13,7 @@ from .core.sitemaps import sitemapsfrom .core.urls import urlpatterns as core_urlsfrom .dashboard.urls import urlpatterns as dashboard_urlsfrom .data_feeds.urls import urlpatterns as feed_urls+from .graphql.api import schemafrom .order.urls import urlpatterns as order_urlsfrom .product.urls import urlpatterns as product_urlsfrom .search.urls import urlpatterns as search_urls@@ -26,7 +27,8 @@ urlpatterns = [include((checkout_urls, 'checkout'), namespace='checkout')),url(r'^dashboard/',include((dashboard_urls, 'dashboard'), namespace='dashboard')),- url(r'^graphql', GraphQLView.as_view(graphiql=settings.DEBUG)),+ url(r'^graphql', GraphQLView.as_view(+ schema=schema, graphiql=settings.DEBUG), name='api'),url(r'^jsi18n/$', JavaScriptCatalog.as_view(), name='javascript-catalog'),url(r'^order/', include((order_urls, 'order'), namespace='order')),url(r'^products/',diff --git a/tests/dashboard/test_graphql.py b/tests/dashboard/test_graphql.pynew file mode 100644index 0000000000..ccc0d78747--- /dev/null+++ b/tests/dashboard/test_graphql.py@@ -0,0 +1,185 @@+import json++import graphene+import pytest+from django import forms+from django.shortcuts import reverse++from saleor.dashboard.category.forms import CategoryForm+from saleor.dashboard.graphql.mutations import (+ ModelFormMutation, ModelFormUpdateMutation)+from saleor.product.models import Category, Product, ProductAttribute++from ..utils import get_graphql_content+++class CategoryForm(forms.ModelForm):+ class Meta:+ model = Category+ fields = ['name']+++def test_model_form_mutation():+ class CategoryMutation(ModelFormMutation):+ test_field = graphene.String()++ class Arguments:+ test_input = graphene.String()++ class Meta:+ form_class = CategoryForm+ return_field_name = 'category'++ meta = CategoryMutation._meta+ assert meta.form_class == CategoryForm+ assert meta.model == CategoryForm._meta.model+ assert meta.return_field_name == 'category'++ arguments = meta.arguments+ # check if declarative arguments are present+ assert 'test_input' in arguments+ # check if model form field is present+ assert 'name' in arguments++ output_fields = meta.fields+ assert 'category' in output_fields+ assert 'errors' in output_fields+++def test_model_form_update_mutation():+ class CategoryUpdateMutation(ModelFormUpdateMutation):+ class Meta:+ form_class = CategoryForm++ meta = CategoryUpdateMutation._meta+ assert 'id' in meta.arguments+++def test_category_create_mutation(client):+ query = """+ mutation($name: String!, $description: String, $parentId: ID) {+ categoryCreate(+ name: $name+ description: $description+ parentId: $parentId+ ) {+ category {+ id+ name+ slug+ description+ parent {+ name+ id+ }+ }+ errors {+ field+ message+ }+ }+ }+ """++ category_name = 'Test category'+ category_description = 'Test description'++ # test creating root category+ variables = json.dumps({+ 'name': category_name, 'description': category_description})+ response = client.post(+ reverse('dashboard:api'), {'query': query, 'variables': variables})+ content = get_graphql_content(response)+ assert 'errors' not in content+ data = content['data']['categoryCreate']+ assert data['errors'] == []+ assert data['category']['name'] == category_name+ assert data['category']['description'] == category_description+ assert not data['category']['parent']++ # test creating subcategory+ parent_id = data['category']['id']+ variables = json.dumps({+ 'name': category_name, 'description': category_description,+ 'parentId': parent_id})+ response = client.post(+ reverse('dashboard:api'), {'query': query, 'variables': variables})+ content = get_graphql_content(response)+ assert 'errors' not in content+ data = content['data']['categoryCreate']+ assert data['errors'] == []+ assert data['category']['parent']['id'] == parent_id+++def test_category_update_mutation(client, default_category):+ query = """+ mutation($id: ID, $name: String!, $description: String) {+ categoryUpdate(+ id: $id+ name: $name+ description: $description+ ) {+ category {+ id+ name+ description+ parent {+ id+ }+ }+ errors {+ field+ message+ }+ }+ }+ """+ # create child category and test that the update mutation won't change+ # it's parent+ child_category = default_category.children.create(name='child')++ category_name = 'Updated name'+ category_description = 'Updated description'++ category_id = graphene.Node.to_global_id('Category', child_category.pk)+ variables = json.dumps({+ 'name': category_name, 'description': category_description,+ 'id': category_id})+ response = client.post(+ reverse('dashboard:api'), {'query': query, 'variables': variables})+ content = get_graphql_content(response)+ assert 'errors' not in content+ data = content['data']['categoryUpdate']+ assert data['errors'] == []+ assert data['category']['id'] == category_id+ assert data['category']['name'] == category_name+ assert data['category']['description'] == category_description++ parent_id = graphene.Node.to_global_id('Category', default_category.pk)+ assert data['category']['parent']['id'] == parent_id+++def test_category_delete_mutation(client, default_category):+ query = """+ mutation($id: ID!) {+ categoryDelete(id: $id) {+ category {+ name+ }+ errors {+ field+ message+ }+ }+ }+ """+ variables = json.dumps({+ 'id': graphene.Node.to_global_id('Category', default_category.id)})+ response = client.post(+ reverse('dashboard:api'), {'query': query, 'variables': variables})+ content = get_graphql_content(response)+ assert 'errors' not in content+ data = content['data']['categoryDelete']+ assert data['category']['name'] == default_category.name+ with pytest.raises(Category.DoesNotExist):+ default_category.refresh_from_db()diff --git a/tests/test_graphql.py b/tests/test_graphql.pyindex 933258171d..3909908f1f 100644--- a/tests/test_graphql.py+++ b/tests/test_graphql.py@@ -2,58 +2,11 @@ import jsonimport grapheneimport pytest-from django import forms+from django.shortcuts import reverse-from saleor.dashboard.category.forms import CategoryForm-from saleor.graphql.core.mutations import (- ModelFormMutation, ModelFormUpdateMutation)from saleor.product.models import Category, Product, ProductAttribute--class CategoryForm(forms.ModelForm):- class Meta:- model = Category- fields = ['name']---def test_model_form_mutation():- class CategoryMutation(ModelFormMutation):- test_field = graphene.String()-- class Arguments:- test_input = graphene.String()-- class Meta:- form_class = CategoryForm- return_field_name = 'category'-- meta = CategoryMutation._meta- assert meta.form_class == CategoryForm- assert meta.model == CategoryForm._meta.model- assert meta.return_field_name == 'category'-- arguments = meta.arguments- # check if declarative arguments are present- assert 'test_input' in arguments- # check if model form field is present- assert 'name' in arguments-- output_fields = meta.fields- assert 'category' in output_fields- assert 'errors' in output_fields---def test_model_form_update_mutation():- class CategoryUpdateMutation(ModelFormUpdateMutation):- class Meta:- form_class = CategoryForm-- meta = CategoryUpdateMutation._meta- assert 'id' in meta.arguments---def get_content(response):- return json.loads(response.content.decode('utf8'))+from .utils import get_graphql_contentdef test_category_query(client, product_in_stock):@@ -88,8 +41,8 @@ def test_category_query(client, product_in_stock):}}''' % {'category_pk': graphene.Node.to_global_id('Category', category.pk)}- response = client.post('/graphql/', {'query': query})- content = get_content(response)+ response = client.post(reverse('api'), {'query': query})+ content = get_graphql_content(response)assert 'errors' not in contentcategory_data = content['data']['category']assert category_data is not None@@ -119,8 +72,8 @@ def test_fetch_all_products(client, product_in_stock):}}'''- response = client.post('/graphql/', {'query': query})- content = get_content(response)+ response = client.post(reverse('api'), {'query': query})+ content = get_graphql_content(response)assert 'errors' not in contentnum_products = Product.objects.count()assert content['data']['products']['totalCount'] == num_products@@ -142,8 +95,8 @@ def test_fetch_unavailable_products(client, product_in_stock):}}'''- response = client.post('/graphql/', {'query': query})- content = get_content(response)+ response = client.post(reverse('api'), {'query': query})+ content = get_graphql_content(response)assert 'errors' not in contentassert content['data']['products']['totalCount'] == 0assert not content['data']['products']['edges']@@ -183,8 +136,8 @@ def test_product_query(client, product_in_stock):}}''' % {'category_id': graphene.Node.to_global_id('Category', category.id)}- response = client.post('/graphql/', {'query': query})- content = get_content(response)+ response = client.post(reverse('api'), {'query': query})+ content = get_graphql_content(response)assert 'errors' not in contentassert content['data']['category'] is not Noneproduct_edges_data = content['data']['category']['products']['edges']@@ -210,7 +163,7 @@ def test_filter_product_by_category(client, product_in_stock):}'''response = client.post(- '/graphql/',+ reverse('api'),{'query': query,'variables': json.dumps(@@ -218,7 +171,7 @@ def test_filter_product_by_category(client, product_in_stock):'categoryId': graphene.Node.to_global_id('Category', category.id)}),'operationName': 'getProducts'})- content = get_content(response)+ content = get_graphql_content(response)assert 'errors' not in contentproduct_data = content['data']['products']['edges'][0]['node']assert product_data['name'] == product_in_stock.name@@ -235,14 +188,14 @@ def test_fetch_product_by_id(client, product_in_stock):}'''response = client.post(- '/graphql/',+ reverse('api'),{'query': query,'variables': json.dumps({'productId': graphene.Node.to_global_id('Product', product_in_stock.id)})})- content = get_content(response)+ content = get_graphql_content(response)assert 'errors' not in contentproduct_data = content['data']['node']assert product_data['name'] == product_in_stock.name@@ -268,8 +221,8 @@ def test_filter_product_by_attributes(client, product_in_stock):''' % {'category_id': graphene.Node.to_global_id('Category', category.id),'filter_by': filter_by}- response = client.post('/graphql/', {'query': query})- content = get_content(response)+ response = client.post(reverse('api'), {'query': query})+ content = get_graphql_content(response)assert 'errors' not in contentproduct_data = content['data']['category']['products']['edges'][0]['node']assert product_data['name'] == product_in_stock.name@@ -295,8 +248,8 @@ def test_attributes_query(client, product_in_stock):}}'''- response = client.post('/graphql/', {'query': query})- content = get_content(response)+ response = client.post(reverse('api'), {'query': query})+ content = get_graphql_content(response)assert 'errors' not in contentattributes_data = content['data']['attributes']['edges']assert len(attributes_data) == attributes.count()@@ -322,8 +275,8 @@ def test_attributes_in_category_query(client, product_in_stock):}}''' % {'category_id': graphene.Node.to_global_id('Category', category.id)}- response = client.post('/graphql/', {'query': query})- content = get_content(response)+ response = client.post(reverse('api'), {'query': query})+ content = get_graphql_content(response)assert 'errors' not in contentattributes_data = content['data']['attributes']['edges']assert len(attributes_data) == ProductAttribute.objects.count()@@ -468,133 +421,3 @@ def test_real_query(client, product_in_stock):'attributesFilter': [filter_by]})})content = get_content(response)assert 'errors' not in content---def test_category_create_mutation(client):- query = """- mutation($name: String!, $description: String, $parentId: ID) {- categoryCreate(- name: $name- description: $description- parentId: $parentId- ) {- category {- id- name- slug- description- parent {- name- id- }- }- errors {- field- message- }- }- }- """-- category_name = 'Test category'- category_description = 'Test description'-- # test creating root category- variables = json.dumps({- 'name': category_name, 'description': category_description})- response = client.post(- '/graphql/', {'query': query, 'variables': variables})- content = get_content(response)- assert 'errors' not in content- data = content['data']['categoryCreate']- assert data['errors'] == []- assert data['category']['name'] == category_name- assert data['category']['description'] == category_description- assert not data['category']['parent']-- # test creating subcategory- parent_id = data['category']['id']- variables = json.dumps({- 'name': category_name, 'description': category_description,- 'parentId': parent_id})- response = client.post(- '/graphql/', {'query': query, 'variables': variables})- content = get_content(response)- assert 'errors' not in content- data = content['data']['categoryCreate']- assert data['errors'] == []- assert data['category']['parent']['id'] == parent_id---def test_category_update_mutation(client, default_category):- query = """- mutation($id: ID, $name: String!, $description: String) {- categoryUpdate(- id: $id- name: $name- description: $description- ) {- category {- id- name- description- parent {- id- }- }- errors {- field- message- }- }- }- """- # create child category and test that the update mutation won't change- # it's parent- child_category = default_category.children.create(name='child')-- category_name = 'Updated name'- category_description = 'Updated description'-- category_id = graphene.Node.to_global_id('Category', child_category.pk)- variables = json.dumps({- 'name': category_name, 'description': category_description,- 'id': category_id})- response = client.post(- '/graphql/', {'query': query, 'variables': variables})- content = get_content(response)- assert 'errors' not in content- data = content['data']['categoryUpdate']- assert data['errors'] == []- assert data['category']['id'] == category_id- assert data['category']['name'] == category_name- assert data['category']['description'] == category_description-- parent_id = graphene.Node.to_global_id('Category', default_category.pk)- assert data['category']['parent']['id'] == parent_id---def test_category_delete_mutation(client, default_category):- query = """- mutation($id: ID!) {- categoryDelete(id: $id) {- category {- name- }- errors {- field- message- }- }- }- """- variables = json.dumps({- 'id': graphene.Node.to_global_id('Category', default_category.id)})- response = client.post(- '/graphql/', {'query': query, 'variables': variables})- content = get_content(response)- assert 'errors' not in content- data = content['data']['categoryDelete']- assert data['category']['name'] == default_category.name- with pytest.raises(Category.DoesNotExist):- default_category.refresh_from_db()diff --git a/tests/utils.py b/tests/utils.pyindex fc08dc7903..f79b74b5f5 100644--- a/tests/utils.py+++ b/tests/utils.py@@ -1,3 +1,4 @@+import jsonfrom urllib.parse import urlparsefrom django.db.models import Q@@ -20,3 +21,7 @@ def filter_products_by_attribute(queryset, attribute_id, value):in_product = Q(attributes__contains={key: value})in_variant = Q(variants__attributes__contains={key: value})return queryset.filter(in_product | in_variant)+++def get_graphql_content(response):+ return json.loads(response.content.decode('utf8'))