Add testcase

This commit is contained in:
Jonathan Kim 2018-05-04 14:47:00 +01:00
parent 05d7e61b84
commit 26932b2080

View File

@ -0,0 +1,45 @@
# https://github.com/graphql-python/graphene/issues/719
import graphene
class InvitationType(graphene.ObjectType):
creation_date = graphene.String()
class CreateInvitation(graphene.Mutation):
class Arguments:
email = graphene.String(required=True)
invitation = graphene.Field(InvitationType)
def mutate(self, info, email):
return InvitationType(creation_date='2018-05-04T14:45:36')
class Mutations(graphene.ObjectType):
create_invitation = CreateInvitation.Field()
class Query(graphene.ObjectType):
name = graphene.String(default_value="Dave")
def test_issue():
query_string = '''
mutation ($email: String!) {
createInvitation(email: $email) {
invitation {
creationDate
}
}
}
'''
schema = graphene.Schema(query=Query, mutation=Mutations)
result = schema.execute(query_string, variable_values={
'email': 'foo@bar.com',
})
assert not result.errors
# assert result.data['someField'] == 'Oh'