From 26932b2080e588cfd0a2c108e49d49a165529494 Mon Sep 17 00:00:00 2001 From: Jonathan Kim Date: Fri, 4 May 2018 14:47:00 +0100 Subject: [PATCH] Add testcase --- graphene/tests/issues/test_719.py | 45 +++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 graphene/tests/issues/test_719.py diff --git a/graphene/tests/issues/test_719.py b/graphene/tests/issues/test_719.py new file mode 100644 index 00000000..153f3b0a --- /dev/null +++ b/graphene/tests/issues/test_719.py @@ -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'