graphene-django/graphene_django/tests/schema_view.py
Jason Kraus c049ab7470
WIP: Merge master into v3 (#1086)
* merge master into v3

* fix order_by snake casing by checking if value is None, switch executor to execution_context_class since schema.execute no longer supports executor

* fix linting by removing duplicate defintion and test of convert_form_field_to_string_list
2020-12-30 15:37:57 -08:00

33 lines
813 B
Python

import graphene
from graphene import ObjectType, Schema
from .mutations import PetFormMutation, PetMutation
class QueryRoot(ObjectType):
thrower = graphene.String(required=True)
request = graphene.String(required=True)
test = graphene.String(who=graphene.String())
def resolve_thrower(self, info):
raise Exception("Throws!")
def resolve_request(self, info):
return info.context.GET.get("q")
def resolve_test(self, info, who=None):
return "Hello %s" % (who or "World")
class MutationRoot(ObjectType):
pet_form_mutation = PetFormMutation.Field()
pet_mutation = PetMutation.Field()
write_test = graphene.Field(QueryRoot)
def resolve_write_test(self, info):
return QueryRoot()
schema = Schema(query=QueryRoot, mutation=MutationRoot)